PDFTron is pleased to announce the availability of a native PDF viewer and annotation plugin for Ionic and Cordova mobile apps. The plugin provides the ability to include a full-featured PDF viewer that can open PDFs directly from the device or from a web server. The viewer also provides built-in annotation tools that can be saved back to the PDF using standard PDF annotations that are visible in other viewers.

Further, the viewer can also directly open Microsoft Office documents, such as .doc/.docx, .pptx and .xlsx.

All rendering and controls are implemented with native code to provide the best possible performance.

linkPreview

iOSAndroid
iOS Ionic PDF ViewerAndroid Ionic PDF Viewer

linkCross-platform API

The API is 100% iOS/Android cross-platform. This is how to show a full-screen viewer:

var viewer = new PDFTron.NativeViewer({
    initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_mobile_about.pdf'
});

viewer.showDocumentViewer();

linkCustomizable

It is also possible to customize the viewer. For example the following code hides the "share" button, and disables the ability to create ink and text annotations:

var viewer = new PDFTron.NativeViewer({
    initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_mobile_about.pdf',
    disabledElements: [
            shareButton,
            freeTextToolButton, 
            freeHandToolButton
          ]
});

viewer.showDocumentViewer();

linkNon-full screen mode capable

The viewer supports being presented over only part of the screen by specifying a particular region within the app:

var viewerElement = document.getElementById('pdftron-viewer');
var rect = viewerElement.getBoundingClientRect();

var viewer = new PDFTron.NativeViewer({
    initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/PDFTRON_mobile_about.pdf',
    boundingRect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height }
});

viewer.showDocumentViewer();

linkGet started

Full details can be found on the Ionic / Cordova PDF Viewer Github page.

A sample project that uses the plugin is also available on Github.

Please let us know what you think! You are also very welcome to improve our open source Cordova and Ionic plugin. Please submit a pull request if you are interested. Stay tuned for future improvements!