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.NETAIASP.NET Core

AI Natural Language Document Generation with MCP and TX Text Control .NET

This article explains how AI agents can use natural language to create documents through an MCP server. Instead of letting a language model generate documents directly, the AI translates prompts…


ASP.NETReportingASP.NET Core

C# Document Generation: A Developer's Guide for .NET

Document generation refers to the automatic creation of documents from application data. The success or complexity of a document generation workflow often depends on a single early architectural…


ASP.NETAccessibilityASP.NET Core

Validating PDF/UA Documents in .NET C#: A Practical Guide

This article explains how to validate PDF/UA documents in .NET C# using the TXTextControl.PDF.Validation NuGet package. It shows how to inspect validation status, generate JSON reports, handle…


ASP.NETASP.NET CorePDF

Using QR Codes in PDF Documents in C# .NET

QR codes are a powerful tool for embedding machine-readable information in documents. In this article, we will explore how to generate and insert them into PDF documents using C# .NET with TX Text…

Share on this blog post on: