Some test text!

menu
search

Overview

WebViewer is a JavaScript library for viewing, annotating and editing documents. At its simplest you can view a document by passing WebViewer a document URL and a DOM element where WebViewer will be placed inside your app.

WebViewer({
  initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf'
}, document.getElementById('viewer')).then(instance => {
  // WebViewer is initialized
});

Behind the scenes an iframe is created which instantiates the default WebViewer UI and loads the document. APIs are available to customize the UI and manipulate the viewer and document. Lower level APIs let you create your own viewer or process documents without a UI.

linkHow does it work?

WebViewer takes advantage of client side technologies like WebAssembly and PNaCl to quickly parse and render PDFs. PDFTron's C++ SDK is compiled into a module that can be loaded directly in the browser.

This means that the work of rendering the document is done completely by the browser with no server necessary. A server might be used only to statically host the documents and JavaScript files, but it's also possible to load local files from a user's computer. Having the rendering take place on the client means you don't have to worry about maintaining and scaling servers that do the rendering for you.

PDF, image and Office documents are able to be loaded when using client rendering.

linkImproving client side performance

Client side rendering works well when using modern browsers and reasonably powerful devices but what if a significant portion of your user base is using Internet Explorer or lower powered mobile devices? Client side rendering will still work but the performance may not be acceptable for your users.

For these cases we recommend using WebViewer Server, a drop-in backend for WebViewer that offers responsive viewing and compatibility across all client platforms, along with scaling performance that approaches purely client-side solutions. It works hand-in-hand with WebViewer on the client, initially serving images then transitioning to client-side rendering.

Once your server is deployed you just need to pass an extra constructor option and the same WebViewer APIs can be used for interacting with the document.

WebViewer({
  initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf',
  // demo.pdftron.com is for demo purposes only, replace with your own deployed server
  pdftronServer: 'https://demo.pdftron.com'
}, document.getElementById('viewer')).then(instance => {
  // WebViewer is initialized
});

Internally WebViewer will pass the document URL to the server and the server will download and process it. Based on the capability of the client device/browser and properties of the document, WebViewer Server may switch over to client rendering once client modules are loaded, optimize the document for client rendering or continue rendering on the server.

linkWhat if you want more control of the server?

WebViewer Server is provided as a Docker container or a direct Tomcat installer and has quite a few options for configuration, but in some cases it may be preferable to have more control of the server environment. Behind the scenes WebViewer Server uses PDFTron's native PDF SDK for rendering and optimizing files and you can take advantage of these same APIs on your own server. The cross platform SDK is available for Linux, Windows and Mac in a variety of languages.

Using the PDFTron server SDK you can convert many types of documents into web optimized XPS files, called XOD, which are able to be quickly rendered by WebViewer in any browser or device. Using XOD files also allows for workflows where you pre-convert your documents for best performance. You can read more about custom server deployment here.

linkSupporting more file formats

Besides improved performance, WebViewer Server also provides out of the box support for loading a number of other document format including CAD documents. A full list is provded here.

With WebViewer Server all you need to do is pass a URL to one of the supported document types to have it loaded in WebViewer. When using the PDFTron SDK on your own server you will need to convert the document to XOD or PDF first.

linkSummary

  • The client only setup will be the simplest to set up and maintain as it only requires a static server to host files and processing is all performed client side in the browser. We generally recommend trying out this option first.
  • If you need to support older browsers, lower powered devices or more file formats then WebViewer Server is recommended as it simplifies the deployment and handling of documents. All the server requires is a URL to be able to render documents quickly so you don't need to change your existing file storage location.
  • If you would like the same benefits as WebViewer Server but would also like more control of the server environment then you can use custom server deployment. This requires the use of the server side PDFTron SDK to process documents yourself before sending them to WebViewer.

To get started integrating WebViewer into your app start here.

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn more
close