This GitHub gist repository contains C# code examples used in the Aspose.HTML for .NET documentation, specifically within the SVG Transformations – Rotate, Scale, and Translate SVG chapter. The snippets show how to rotate, translate, scale, skew, crop, and combine transformations with transform attributes, SVG matrices, and the SVG Builder API.
- Rotate SVG Elements and Shapes – Rotate SVG shapes using the
rotate()transform, transformation matrices, or the SVG Builder API. - Scale SVG Content – Apply
scale()transformations to entire documents or individual elements. - Translate SVG Elements – Move shapes with the
translate()transform or an SVG transformation matrix. - Skew and Crop SVG – Skew SVG content with transform functions and crop SVG images by changing
viewBox. - Transformation Matrices – Combine scale, translate, and rotate operations with SVG matrix values.
- SVG Builder API – Use
SVGSVGElementBuilderandSVGRectElementBuilderto apply transformations in fluent C# code.
- Make sure you have the Aspose.SVG for .NET library installed.
- Locate the example that matches your SVG transformation task.
- Open and adjust the example files with your paths and file names.
- Run the code to create transformed SVG output files.
Aspose.SVG for .NET is a cross-platform library enabling full control over SVG graphics in C# applications. It provides an API for creating, editing, saving, and converting SVG content without requiring external software. With DOM manipulation, SVG Builder, and transformation matrix support, it helps automate vector graphics tasks such as rotation, scaling, translation, skewing, cropping, and conversion.
To run the examples, you need:
- .NET Framework 4.6.1+, .NET Core 2.0+, or .NET 5+.
- Supported OS: Windows, Linux, macOS.
- The Aspose.SVG for .NET library (you can install it via NuGet:
Install-Package Aspose.SVG).