Some test text!

menu
search

Full API

WebViewer's standard API provides document viewing and basic PDF manipulation APIs, but doesn't provide more advanced document processing APIs.

PDFTron provides a cross platform document processing API and the WebViewer full API is the in-browser JavaScript implementation of this. The PDFTron C++ SDK is converted to a WebAssembly module allowing the same APIs to be used directly in the browser. Tasks that previously would have required a server can now be done completely client side.

See the full API samples for an example of this functionality.

The full API is not available when loading documents using WebViewer Server. When loading XOD documents with a custom server you can use the PDFTron server side SDK to perform operations before reconverting your documents.

linkHow to enable it

When using the default WebViewer UI you can enable the full API by passing the fullAPI option into the WebViewer initializer. This will make the PDFNet namespace available on the WebViewer instance and allow you to access a PDFDoc instance from the WebViewer document object.

WebViewer({
  licenseKey: 'Insert commercial license key here after purchase',
  initialDoc: 'YOUR_FILE.pdf',
  fullAPI: true
}, viewerElement).then(function(instance) {
  var PDFNet = instance.PDFNet;
  console.log(PDFNet);

  var docViewer = instance.docViewer;
  docViewer.on('documentLoaded', function() {
    var webViewerDoc = docViewer.getDocument();

    var pdfDoc = webViewerDoc.getPDFDoc();
    // access additional functionality on the PDFDoc object
    // e.g. pdfDoc.fdfMerge(...)
  });
})

You can also load it without a viewer by including the PDFNet.js script along with CoreControls.js directly in your page. See this guide for more details.

linkWhat are the tradeoffs of enabling it?

The reason why the full API isn't enabled by default is that the full API WebAssembly module is ~2-3 times larger than the default client side module that only supports rendering. This means that it will take a longer to download and process, affecting the WebViewer start up time.

If you don't require any of these APIs then it doesn't make sense to load the full API and have a slower start up time. If you are only viewing and annotating documents then you most likely do not need to enable the full API.

linkRecommended browsers and devices

Although the full API will run on any browser or device, the performance may not be acceptable on mobile devices and older browsers like IE11. If you need to support these browsers or devices we recommend using a custom server and performing the processing on the server side.

linkHow it works behind the scenes

You can load the full API with or without the default viewer. With the default UI you can manipulate the document using the PDFNet APIs and then refresh it in the viewer. Alternatively you can process a document in the background without rendering pages at all.

linkWithout a viewer

CoreControls.js and PDFNet.js are loaded directly inside your web app. See this guide for more details.

linkWith the default UI

Below is an expanded diagram of the default UI that shows the how the full API is loaded when running with the viewer. For more information about running with the default viewer and how it works behind the scenes see 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