Can text added to an SVG document be vectorized in the final output?

Is it possible to have text inserted into an SVG document convert to vector form in the saved file?

For example, I can add a text element:

(open tag)text style=“font-size: 70px; font-family: Arial, Helvetica, sans-serif; font-weight: 700;”(close tag)TAHITI(open tag)/text(close tag)

but I would like the text string vectorized in the output, if possible. If not, are there other solutions?

One reason is to protect intellectual property: nosy clients can’t simply change the text in the SVG file by opening it in Notepad.

@GPTW_Jim

Thanks for contacting support.

Would you kindly share an expected output SVG file with us so that we can further proceed to assist you accordingly.

Example_graphic.zip (3.2 KB)

Thank you. I’ve attached a zip file containing the SVG file in question. (This editing window doesn’t accept .svg file uploads directly.)

The image shows a date range and country name at the bottom. This text needs to be dynamic and set programmatically. The rest of this image is a static template that was created in Adobe Illustrator. Notice that in the internal XML, Illustrator represented the static text as vector shapes.

I added text elements with id attributes to serve as placeholders for the dynamic text. I’m using Aspose.svg to find each of the three text elements and insert the desired text.

VB example for setting a passed-in country name:

    Dim countryNameElement As SVGTextElement = DirectCast(document.GetElementById("countryName"), SVGTextElement)
    countryNameElement.TextContent = countryName

Finally I use document.Save(filename) to save the final image file.

(1) This file LOOKS good and is what I want to present to the user.

(2) But, internally the dynamic text is readable in the XML text tags. I would like this text to be converted to vector shapes like the rest of the static text. This prevents casual users from opening and editing this file in a text editor (e.g. Notepad). A determined user would need to use Adobe Illustrator or similar tool.

(3) If the dynamic text could be converted to vector shapes on the server, we would not be limited to common fonts that all users can be expected to have. In this example I’m using Arial, but would like freedom to use other fonts that adhere to our brand guidelines.

Thoughts? Is there a different way I should be doing this?

Thanks!

Jim

@GPTW_Jim

Thanks for sharing further details and sample file.

We need to further investigate about the feature that you want to implement. For the purpose, we have logged an investigation ticket as SVG-47 in our issue management system. We will further look into its details and keep you posted with the status of its resolution. Please be patient and spare some time.

@GPTW_Jim

We would like to share with you that a new feature for the vectorization of text elements inside SVG document was added. We have attached two document where “comlex.svg” is SVG document that contains text and “vectorized_complex.svg” is a new SVG document where text replaced with help of combination SVG “path”, “use”, “mask”, “g” elements. This approach allows applying “filter”, “mask”, “opacity” and other effects to the vectorized text. The “use” elements are needed to repeat the same text glyphs and decrease the size of the result SVG document.

The vectorization of text documents is carried out by saving them with a new parameter VectorizeText:

using Aspose.Svg;
using Aspose.Svg.Saving;

using (var document = new SVGDocument(@"source.svg"))
{
document.Save(@"vectorized_text.svg", new SVGSaveOptions() {VectorizeText=true});
}

samplefiles.zip (13.3 KB)

This feature is in the release 20.9.0