Some test text!

keyboard_arrow_down

Getting started

Quick startDownload and run samplesIntegrate into your projectDeployment optionsMigrating to v4
keyboard_arrow_down

Deployment options

keyboard_arrow_down

Fundamentals

keyboard_arrow_down

Basics

keyboard_arrow_down

Annotations

keyboard_arrow_down

UI

keyboard_arrow_down

Legacy UI

keyboard_arrow_down

Advanced

keyboard_arrow_down

PDFNetJS Full

keyboard_arrow_down

PDF Processing API

What is PDFNet?Opening a documentSerializing (saving) a documentWorking with pagesWorking with Page ContentWorking with BookmarksWorking with Interactive Forms (AcroForms)PDF SecurityLow-level PDF APIError handling
Migrating to v4keyboard_arrow_down

Migrating to v4

In this document
chevron_rightCase change
chevron_rightNo more jQuery
chevron_rightAnnotationManager drawAnnotations is asynchronous
chevron_rightNew default viewer
An evaluation or commercial license key is required to run PDFTron. If you are evaluating the SDK and do not have a key, please obtain one, and then visit this page via the link included in the trial email. If your company has licensed PDFTron then you already received your key in an email from team@pdftron.com. See sign in for more details.

There are a few breaking changes when migrating to v4 from older versions.

linkCase change

UpperCamelCase in the main files, WebViewer.min.js and WebViewer.js, have been updated to lowercase.

<!-- Version 3.x and older -->
<script src='lib/WebViewer.min.js'></script>

<!-- Version 4.0 and after -->
<script src='lib/webviewer.min.js'></script>

linkNo more jQuery

From 4.0, you don't need to load jquery before WebViewer anymore.

<!-- Version 3.x and older -->
<script src='lib/html5/external/jquery-3.2.1.min.js'></script>

<!-- Version 4.0 and after -->
<!-- nothing! -->

This means that event-listening functions need to be updated too.

// Version 3.x and older
$(viewerElement).on('documentLoaded', function() {
  ...
});

// Version 4.0 and after
viewerElement.addEventListener('documentLoaded', function() {
  ...
});

linkAnnotationManager drawAnnotations is asynchronous

The drawAnnotations function is now asynchronous and returns a promise that resolves when drawing has completed.

Generally this won't cause problems for existing code as long as subsequent code isn't relying on the annotation drawing to have completed. If you do rely on this then you'll just need to move the code into a then block. For example:

// Version 3.x and older
annotManager.drawAnnotations(1);
// something that relies on the annotations to be finished drawing

// Version 4.0 and after
annotManager.drawAnnotations(1).then(function() {
  // something that relies on the annotations to be finished drawing
});

linkNew default viewer

The default viewer has been updated to WebViewer UI v1, which means that customizations you've made to the UI for the legacy viewer will not work anymore. You can either learn about the new viewer or add a constructor option to use the legacy viewer. Note that the new default viewer does not support IE9 or 10. If you want to support IE9 and 10 you will need to use the legacy viewer.

Also note that customizations using the WebViewer core APIs remain mostly unchanged so those customizations will continue to work.