This step by step tutorial shows you how to rotate barcode image in C#. It rotates the generated barcode at specified angle in C# code. The barcode can be rotated horizontally or vertically as per your needs in your C# applications.
Steps to Rotate Barcode Image in C#
- Include Aspose.BarCode for .NET Nuget package
- Add reference to Aspose.Barcode and Aspose.BarCode.Generation namespaces
- Use SetLicense method to apply the license
- Create an object of BarCodeGenerator Class using EncodeType as Code128
- Specify the barcode text using CodeText property
- Set required rotation angle using RotationAngle attribute
- Save the rotated barcode image as PNG image format
In another tutorial, we showed you the code to Generate QR Code in C# from scratch. That barcode had no rotation. However, by following the above steps, you can create rotated barcode in C# as well.
Code to Rotate Barcode Image in C#
In the above example, we have rotated barcode at 45 degrees, but you can rotate the generated barcode at any degrees. For example, you might want to rotate barcode at 90 degrees in C# web or desktop applications.