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 TX Text Control .NET Server for ASP.NET
Web.MVC.DocumentViewer Namespace
DocumentViewerSettings Class
The DocumentViewerSettings class contains the DocumentViewer extension settings.
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()
view raw test.cshtml hosted with ❤ by GitHub

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.