Some test text!

Discord Logo

Chat with us

PDFTron is now Apryse, learn more here.

Core / Guides / Electron



PDFTron is now Apryse, learn more here.

Get started with Electron

Welcome to Apryse.

Integrating Electron with WebViewer JavaScript PDF library

This guide will help you integrate a free trial of WebViewer into Electron applications on the browser. It will help you clone the Electron sample repository, walk through the project structure, and show you how to call other WebViewer API. Your free trial includes unlimited trial usage and support from solution engineers.


Node.js is not required for WebViewer
WebViewer does not require Node, npm, or node_modules. It is only recommended to run the samples.
  • Electron

  • Platform specific prerequisites.

    Electron applications can be built for several platforms and each has its own prerequisites. Please ensure they are fulfilled for your required platform by referring to the electron.js documentation.

No trial license key required.
The trial of Apryse SDK works without a license key. A commercial license key is required for use in a production environment. Please fill out our licensing form if you do not have a valid license key.
Keep your commercial license key confidential.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).

Initial setup

  1. Clone the webviewer-electron-sample repository:

    git clone
  2. Enter the directory and run npm install:

    cd webviewer-electron-sample
    npm install

    This will automatically download and extract the Apryse WebViewer Package.

You are now ready to run the sample or use more WebViewer APIs.

Sample overview

After initial setup, the webviewer-electron-sample directory should be laid out like this:

├── package.json
├── node_modules
│   ├── ...
├── public
│   ├── index.html
│   ├── files
│   │   ├── ...
│   └── lib
│       ├── ...
└── src
    ├── App.js
    └── main.js

Notable files and directories include:

LICENSELists the copyright and license information.
package.jsonLists the manifest of the project and contains the author/version metadata.
publicContains the static assets such as the main HTML page index.html, the WebViewer libraries and the sample PDF file
srcContains the .js files for the Electron project.

In short, main.js handles the OS checks and creates the main window for the application with a link to index.html.

App.js instantiates the WebViewer in the viewer element outlined by index.html. It is also where the WebViewer API calls are placed.

Run the sample

  1. To run the sample, make sure you are in the webviewer-electron-sample directory and execute

    npm start

    You should see the application start up. It will load the WebViewer and display the PDF sample in /public/files:


If you run into issues with installing and/or running the application, please return and ensure you have the prerequisites installed.

Use more WebViewer APIs

To call more WebViewer APIs, open /src/App.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:

Execute npm start again and the theme of the viewer will change:


Next step

Usage Guides Samples API docs

You can find the full source code for this project here.


Network Failure More information about fixing the Network Failure issue on WebViewer.

Get the answers you need: Support