Rotate SVG Image C#

SVG files define the graphics in XML format. They can be scaled or printed at any size without disturbing the quality of the image. In some cases, you may need to rotate an SVG image. Accordingly, this article covers how to rotate an SVG image programmatically in C#.

C# SVG Image Rotation – API Installation

Aspose.SVG for .NET supports working with SVG files. You can edit, update, or create SVG images from within your .NET Framework-based applications. Simply download the reference DLL files from the Downloads page, or run the NuGet installation command below:

PM> Install-Package Aspose.SVG

How to Rotate SVG Image File Programmatically in C#

You can rotate an SVG image file with the following steps:

  1. Open the input SVG file and create a graphic element.
  2. Set rotate transformation and specify the degree for rotation.
  3. Append the graphic element.
  4. Save the rotated SVG image.

Rotate an SVG Image Programmatically in C#

You need to follow the steps below to rotate an SVG image in C#:

  1. Load the input SVG file with the SVGDocument class.
  2. Mention the angle for rotation and set rotate transformation.
  3. Append the graphic element.
  4. Write the output rotated SVG image using the Save method.

The code below explains how to rotate an SVG image with embedded HTML content programmatically using C#:

Get Free API License

You may request a free temporary license to test the API to its full capacity.

Conclusion

In this article, you have learned how to rotate an SVG image programmatically in C#. Moreover, you may visit the documentation section to learn other features of the API. In case of any ambiguity, please feel free to reach out to us at forum.

See Also