This gist collection contains C# code examples from the SVG Basic Operations chapter of the Aspose.SVG for .NET documentation. Learn how to create, load, edit, navigate, inspect, and save SVG documents programmatically, including SVGZ compression and external resource handling.
This gist collection provides ready-to-use C# examples covering:
- Creating SVG documents – Create empty SVG documents, generate SVG from string content, and use the SVG Builder API.
- Loading SVG files – Load SVG documents from files, streams, URLs, and strings with external resource resolution.
- Editing SVG documents – Add shapes, edit path data, and modify existing SVG content using the DOM API.
- Navigating and inspecting SVG – Traverse SVG elements and inspect document content programmatically.
- Using CSS Selectors and XPath – Find and modify SVG elements with CSS selectors and XPath expressions.
- Saving SVG documents – Save SVG files and external resources to files, memory streams, ZIP archives, or URLs.
- Converting SVG and SVGZ files – Save SVG as compressed SVGZ and convert SVGZ files back to SVG.
The C# code snippets are self-contained and intended to provide a quick start when learning and integrating Aspose.SVG for .NET into your own projects.
- Make sure you have the Aspose.SVG for .NET library installed.
- Clone or download this gist repository.
- Open any example in your preferred .NET environment.
- Adjust file paths, input, and output parameters as needed.
- Run the code to see how specific features work in practice.
You can download a free trial of Aspose.SVG for .NET and use a temporary license for unrestricted access.
- .NET Platforms: .NET Framework 4.6.1+, .NET Core 2.0+, or .NET 5+.
- Supported OS: Windows, Linux, macOS.
- Development environment such as Visual Studio or JetBrains Rider.
- Aspose.SVG for .NET installed via NuGet.
- Documentation – Aspose.SVG for .NET
- API Reference – Aspose.SVG for .NET
- Product page – Aspose.SVG for .NET
- Blog – Aspose.SVG Product Family
If you have questions or suggestions for improvement on these examples, please visit the Aspose.SVG Support Forum. We welcome your comments and feedback.