Products Technologies Demo Docs Blog Support Company

Page Rendering Engine: Creating Thumbnails or Multipage TIFF Images

A very popular new feature of TX Text Control .NET for Windows Forms 15.0 is the Page Rendering Engine. It allows you to export metafiles or images from each separate page of TX Text Control. The content of the page is exactly the same content (rendering) like in an exported PDF or printed document. Technically, the Page object of the PageCollection got a new method called GetImage with the following implementations: public System.Drawing.Imaging.Metafile GetImage(PageContent contents)…

Page Rendering Engine: Creating Thumbnails or Multipage TIFF Images

A very popular new feature of TX Text Control .NET for Windows Forms 15.0 is the Page Rendering Engine. It allows you to export metafiles or images from each separate page of TX Text Control. The content of the page is exactly the same content (rendering) like in an exported PDF or printed document.

Technically, the Page object of the PageCollection got a new method called GetImage with the following implementations:

public System.Drawing.Imaging.Metafile GetImage(PageContent contents)
public System.Drawing.Imaging.Bitmap GetImage(int zoomFactor, PageContent contents)
Text Control

The first implementation returns a Metafile that can be easily processed by using standard .NET classes. You could convert it to other image formats, print the metafile directly in a PrintDocument or scale it freely to your required size to display it in an image control. The right-hand diagram shows these possibilities.

The second implementation creates a Bitmap that can be saved as an image out-of-the-box without creating an image explicitely. You can specify the zoom factor in the GetImage method that should be used to create the high quality image of the specific page.

In both implementations, you need to specify the page content that should be exported. The following values are allowed:

  • All: The image contains all parts.
  • Background: The image contains the background of the page.
  • HeadersAndFooters: The image contains the header and the footer of the page.
  • MainText: The image contains the page's text contents.

The following code creates TIFF images from each page of the current document and stores them in an ArrayList.

ArrayList inputImages = new ArrayList();
foreach (Page page in textControl1.GetPages())
{
    MemoryStream image = new MemoryStream();
    Bitmap mf = page.GetImage(100, TXTextControl.Page.PageContent.All);
    mf.Save(image, ImageFormat.Tiff);
    inputImages.Add(image);
}

There are many different applications for this new feature and I am very interested in your solutions. Feel free to send me your ideas or questions you might have. What did you realize with the Page Rendering Engine?

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

ASP.NETWindows FormsWPF

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…


ASP.NETWindows FormsWPF

TX Text Control 33.0 SP2 is Now Available: What's New in the Latest Version

TX Text Control 33.0 Service Pack 2 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…