Some test text!
Welcome to PDFTron. PDFTron technology can be integrated with Cordova using various platforms. You can select your desired platform below.
This guide will help you integrate a free trial of WebViewer into Cordova applications on the browser. It will help you clone the Cordova sample repository, walk through the project structure, and show you how to call other WebViewer APIs. Your free trial includes unlimited trial usage and support from solution engineers.
Note: There are other approaches that can be used to integrate PDFTron technology with Cordova. Please see this FAQ page to find out more about the relative strengths of each approach.
npm install -g cordova
You may have to restart your Command Prompt to access Cordova commands.
git clone https://github.com/PDFTron/webviewer-cordova-sample.git
Enter the directory and run npm install:
cd webviewer-cordova-sample npm install
This will automatically download and extract the PDFTron WebViewer Package.
After initial setup, the
webviewer-cordova-sample directory should be laid out like this:
webviewer-cordova-sample ├── LICENSE ├── package.json ├── package-lock.json ├── README.md ├── node_modules │ ├── ... ├── hooks │ ├── ... ├── res │ ├── ... ├── platforms │ └── browser | ├── ... └── www ├── index.html ├── js | ├── lib | | ├── ... | └── index.js ├── css | └── index.css └── img └── logo.png
Notable files and directories include:
|LICENSE||Lists the copyright and license information.|
|package.json||Lists the manifest of the project and contains the author/version metadata.|
|platforms||Contains the platform specific directories and files required to run the project. The |
|www||Contains all the assets such as the main HTML page |
www/js/index.js instantiates the WebViewer in the
viewer element outlined by
index.html. It is also where the WebViewer API calls are placed.
Run the application by executing:
Note: If your build fails, use the following command to see a list of requirements for your added platforms:
Your app should look like this:
To call more WebViewer APIs, open
/www/js/index.js in your favorite text editor and add the API calls to the callback for the WebViewer instantiation:
For example, if you want to change the theme of the WebViewer to dark mode, you would add the following:
npm start again and the theme of the viewer will change.
Get the answers you need: Support