You can vectorize text by converting it to digital graphics in an SVG file. It is helpful for text security purposes like when you want to protect a copyrighted font from unwanted use. This article covers how to perform text vectorization programmatically using C#:
- Text Vectorization in C# – API Installation
- Text Vectorization in SVG Image Programmatically using C#
- Vectorize Text in SVG Image from a URL Programmatically in C#
Text Vectorization in C# – API Installation
Aspose.SVG for .NET API has been designed to create, edit, and manipulate SVG images programmatically in .NET Framework-based applications. You can install the API by downloading the DLL file from the Downloads section, or with the following NuGet installation command:
PM> Install-Package Aspose.SVG
Text Vectorization in SVG Image Programmatically using C#
SVG images are popular because of their scalability without compromising on the quality of image. You can replace all font glyphs to path, mask, etc., elements to secure the fonts. Therefore, the vectorized text can maintain the font styles in any system environment or operating system, irrespective of the font installation. You can perform text vectorization with the following steps:
- Load input SVG image with SVGDocument class.
- Set text elements vectorization.
- Save the SVG document with specified SVGSaveOptions.
The following code shows how to achieve text vectorization in SVG image using C# language:
Vectorize Text in SVG Image from a URL Programmatically in C#
SVG images are vastly used over the internet and you may need to vectorize text from an online image. The API supports loading the source image directly from the URL and then vectorising the text. You need to follow the following steps to vectorize an SVG image from a URL:
- Load input SVG image file from a URL.
- Initialize SVGSaveOptions class object.
- Set VectorizeText property to a boolean value.
- Save output SVG image.
The code below explains how to vectorize text in an online SVG image programmatically using C#:
Get Free API License
You can evaluate the API in its full capacity by requesting a Free Temporary License.
Conclusion
In conclusion, you have learned how to vectorize a local image as well as an online hosted SVG image programmatically using C#. Moreover, the appearance of the image is not disturbed during this process because you can apply masks, filters, and opacity to the SVG image. The vectorization secures the text and the font glyphs from unwanted or unauthorized use as per your requirements. You can explore other features of the API by visiting the Documentation. Please feel free to write to us at Free Support Forum for any of your queries.