Products Technologies Demo Docs Blog Support Company

Feature Announcement: Enabling External PDF Renderer PDF.js in TX Text Control DocumentViewer

We are working on a feature that supports the enabling of external document renderers such as PDF.js to render PDF documents. This article gives a quick overview of the possibilities.

Feature Announcement: Enabling External PDF Renderer PDF.js in TX Text Control DocumentViewer

PDF.js is a JavaScript library maintained by Mozilla and other individual contributors. In a future release of our TX Text Control Document Viewer, we will introduce the option to enable external renderers such as PDF.js to provide the document rendering information.

Define the Renderer

In one of the next updates, it will be possible to define the location of PDF.js in the DocumentViewerSettings class through the DocumentLoadSettings. This allows you to specify which renderer should be used to render the loaded PDF document.

@Html.TXTextControl().DocumentViewer(settings => {
   settings.DocumentPath = Server.MapPath("~/App_Data/Documents/test.pdf");
   settings.Dock = DocumentViewerSettings.DockStyle.Fill;
   settings.IsSelectionActivated = true;
   settings.ShowThumbnailPane = true;
   settings.DocumentLoadSettings.PDFJS.BasePath = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146";
}).Render()

After loading the document, the PDF is rendered in the Document Viewer using PDF.js.

TX Text Control with PDF.js

Advantages over pure PDF.js

After PDF.js is enabled, the document is rendered in the Document Viewer like any other supported file type including the thumbnail sidebar, zooming, annotations and the two page view mode:

TX Text Control with PDF.js

This provides users a consistent look and feel when viewing all types of documents in web applications.

When is PDF.js Better as a Renderer?

The answer is quite simple: TX Text Control doesn't provide a PDF renderer. When loading a PDF document into TX Text Control, the PDF is "imported". The idea is to import elements such as paragraphs, tables, and text and do further processing on such documents. Additionally, the TX Text Control PDF import provides the following features:

  • Full text search on PDF documents
  • Retrieve positions and coordinates of elements
  • Extract form field data
  • Radial search for strings and numbers
  • Extract structured documents such as ZUGFeRD

For pure rendering, the PDF.js renderer provides better results.

When not to use PDF Documents

The Document Viewer is mainly used to render documents in the supported formats DOC, DOCX, RTF and the internal Text Control format to help with the following tasks:

  • Document sharing
  • Document collaboration (annotations)
  • Document signing (electronic signatures)
  • Forms completion
  • Document reviewing

All of the above processes should use another document format than PDF to be as flexible as possible. A document should be editable as long as possible as a dynamic structure that should be updatable at any time. PDF is the worst format for these purposes.

When should a PDF be produced in a business workflow?

The answer is very simple: As late as possible.

Learn More

PDFs can be found everywhere: Invoices, brochures, contracts and agreements. It is a very reliable, portable format than became the clear industry standard for exchanging documents. This article suggests when to use this format and why.

Don't Create PDFs - Except You Need Them

When to use PDF Documents

When is a good time to create a PDF that is basically "write only"? Although, it is possible to make changes to a created PDF document like replacing small bits of text or removing complete pages. But when thinking about a PDF in a way like a printed paper sheet, you will get the idea of how dynamic digital document processing should be.

A document should be editable as long as possible. It is a dynamic structure that should be updatable at any time until the process is finished and a document is created for further processing or archiving.

You should use PDF documents in case there is no other option and your resulting documents are only stored in the PDF format or you would like to render incoming PDF documents from third-party sources. Specifically in these cases, PDF.js provides a high quality rendering result. To extract information such as form field data or attached documents, TX Text Control can be used directly.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

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.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETASP.NET CoreDocument Viewer

Use PDF.js to Render PDF Documents within the Document Viewer

With the release of the latest release candidate of the Document Viewer, we released the ability to use PDF.js to render PDF documents. This article shows how to use this new feature.


ASP.NETASP.NET CoreExtraction

Mining PDFs with Regex in C#: Practical Patterns, Tips, and Ideas

Mining PDFs with Regex in C# can be a powerful technique for extracting information from documents. This article explores practical patterns, tips, and ideas for effectively using regular…


ASP.NETASP.NET CoreForms

Streamline Data Collection with Embedded Forms in C# .NET

Discover how to enhance your C# .NET applications by embedding forms for data collection. This article explores the benefits of using Text Control's ASP.NET and ASP.NET Core components to create…


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…