SVG Export Announced for TX Text Control 32.0
SVG will play a central role in future versions of TX Text Control, and one feature is the direct export of SVG images from document pages. This article provides an overview of this new feature.

Scalable Vector Graphics (SVG) is an XML-based vector image format that is developed and maintained by the World Wide Web Consortium (W3C). This format will play a central role in future versions of TX Text Control.
SVG Image Import
In version 30.0, we introduced support for adding SVG images to documents in TX Text Control. This allowed you to add vector graphics to a document and also export them to PDF documents while maintaining scalable images.
Exporting SVG Images
In an upcoming version of TX Text Control (32.0) we will introduce the export of document pages as SVG images. The Get
string svgSources = tx.GetPages()[1].GetImage(TXTextControl.Page.PageContent.All, 300);
As with the other implementations, the Page
The second parameter specifies the resolution of the embedded bitmap images. Since SVG is a vector graphic, pixel-based images are embedded. Depending on the application, the required resolution can be defined.
Rendering Pages as SVGs
The following ASP.NET Core controller code loads a document into TX Text Control and exports and returns the first page as an SVG image.
public IActionResult Index() {
ViewModel model = new ViewModel();
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
tx.Create();
tx.Load("App_Data/lease_agreement.tx", TXTextControl.StreamType.InternalUnicodeFormat);
string svgSources = tx.GetPages()[1].GetImage(TXTextControl.Page.PageContent.All, 300);
model.svgImage = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(svgSources));
}
return View(model);
}
In the view, the returned SVG image is rendered in an <img> HTML tag.
@model tx_svg.Models.ViewModel
<img style="width: 600px; border: 1px solid #c2c2c2;" src="data:image/svg+xml;base64,@Model.svgImage" />
The SVG representation is rendered in the browser:
Zooming
When you zoom into the page, the advantage of SVG is immediately apparent. Vector graphics do not blur when scaled:
Document Viewer and Editor
The Document Editor and Document Viewer use this new technology to render documents, adding significant value to these components. For the Document Viewer, all pages need to be rendered only once for each zoom factor, saving processing power and increasing overall performance.
Stay tuned for more!
ASP.NET
Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.
- Angular
- Blazor
- React
- JavaScript
- ASP.NET MVC, ASP.NET Core, and WebForms
Related Posts
TX Text Control 30.0 Preview: Inserting SVG Images
We are currently working on the anniversary release 30.0 of TX Text Control that is planned to be released in Q4 of 2021. In a series of blog posts, we will preview some of the new features for…
TX Text Control 33.0 SP3 is Now Available: What's New in the Latest Version
TX Text Control 33.0 Service Pack 3 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…
ASP.NETASP.NET CoreDocument Viewer
High-Performance Text Replacement in Large DOCX Files using C# .NET
Learn how to efficiently replace text in large DOCX files using C# .NET and the ServerTextControl component from Text Control. This article demonstrates the performance benefits of using the…
ASP.NETASP.NET CoreDocument Viewer
Document Viewer 33.2.1 Released: New Event and Bug Fixes
This service pack includes important bug fixes and improvements to enhance the stability and performance of the Document Viewer. In addition, a new event has been introduced to provide developers…
ASP.NETAccessibilityASP.NET Core
Upcoming Support for PDF/UA Compliance and Tagged PDF Generation in Version 34.0
We are happy to announce that version 34.0 will support PDF/UA compliance and the creation of tagged PDF documents. This significant update demonstrates our ongoing commitment to accessibility by…