This GitHub gist repository contains C# code samples that demonstrate how to use the powerful SVG Builder API in the Aspose.SVG for .NET library. These examples are used in the SVG Builder – Advanced SVG Creation and Modification chapter of the official Aspose.SVG for .NET documentation and allow .NET developers to programmatically create, modify, and customize SVG documents with exceptional control and flexibility.
Here you will find practical demonstrations of creating, modifying, and fine-tuning SVG documents with an exceptional level of programmatic control, including:
- SVG Element Creation – Create SVG structures from scratch, including basic shapes (circles, rectangles, paths), text, and groups through a fluent SVG Builder API.
- Working with Geometric Shapes – Create and modify basic SVG shapes, including circles, rectangles, and paths.
- Path Data Manipulation – Work directly with SVG path data for intricate shape creation and modification.
- Configuring SVG Styles – Define custom fonts (@font-face) and apply CSS rules to text elements within an SVG document using the SVG Builder API.
- Working with SVG Patterns – Set and apply various SVG patterns (
<pattern>) to fill shapes like circles, etc. - Applying CSS Rules – Define CSS rules for SVG elements (e.g., circle, text) using the Rule Builder API. Set properties like fill, stroke, stroke-width, font-family, and font-size directly within the C# code to style SVG components.
Each gist serves as a standalone, executable example designed to help you quickly understand and implement SVG functionalities in your .NET applications.
- Ensure that you have the Aspose.SVG for .NET library installed.
- Locate the example that corresponds to your specific task.
- Copy the C# code directly from the example.
- Adjust the file paths, input parameters, and output parameters as necessary.
- Run the code to experience the powerful SVG manipulation capabilities.
- .NET Platforms: .NET Framework 4.6.1+, .NET Core 2.0+, or .NET 5+.
- Supported OS: Windows, Linux, macOS.
- Aspose.SVG for .NET installed via NuGet.
Aspose.SVG for .NET is a powerful, on-premise library designed for creating, parsing, processing, and converting SVG files. Its SVG Builder API provides a fluent and flexible approach to programmatically build and modify complex SVG documents, striking a balance between precision and efficiency.