Some test text!


Get started with WebViewer & Salesforce

Welcome to PDFTron. This guide will help you integrate a free trial of WebViewer into Salesforce Lightning Components. It will help you clone the Salesforce sample repository and show you how to integrate WebViewer as a lightning web component. Your free trial includes unlimited trial usage and support from solution engineers.


To fulfill these prerequisites, follow the Salesforce DX Setup Guide.

linkInitial Setup

  1. Download WebViewer and extract it.
  2. Navigate into the extracted folder and run:

    npm run optimize
  3. You will encounter the following prompts, which you should answer y/n as indicated:

    Do you want us to backup your files before optimizing? [y/n]:  y
    Will you be using the new UI? [y/n]:  y
    Will you be using WebViewer Server? See for more info. [y/n]:  n
    Will you be converting all your documents to XOD? See for more info. [y/n]:  n
    Do you need client side office viewing support? [y/n]:  y
    Do you need the full PDF API? See for more info (most users dont need this option). [y/n]:  n
    Do you need to deploy to Salesforce? See for more info (most users dont need this option). [y/n]:  y

    After answering these prompts, answer y to the final confirmation prompt and the script will optimize and zip the source code you’ll need later to a new webviewer-salesforce directory.

    Note that this optimization produces .zip files of no more than 5 mb in size -- small enough for safe upload to the Salesforce platform.

  4. Next clone the webviewer-salesforce sample:

    git clone
  5. Copy the .zip files that were output by the optimizing script in the webviewer-salesforce folder to the force-app/main/default/staticresources folder of the cloned project.


  6. Make sure you are in the cloned project directory and authenticate with your hub org and provide it with an alias (DevHub in the command below) from your command line:

    sfdx force:auth:web:login --setdefaultdevhubusername --setalias DevHub
  7. Enter your Dev Hub org credentials in the browser that opens. (You can close the browser after you log in successfully).
  8. Create a scratch org using the config/project-scratch-def.json file, set the username as your default, and assign it an alias:

    sfdx force:org:create --setdefaultusername -f config/project-scratch-def.json --setalias my-scratch-org
  9. Push the app to your scratch org:

    sfdx force:source:push -f

linkRun the sample

  1. Make sure you are still in the cloned project. Open the scratch org:

    sfdx force:org:open
  2. A browser will open where you should click the app launcher icon, and select PDFTron.


    You should see the application start up:


linkNext step

GuidesSamplesAPI docs

For more information on how to call WebViewer API, check out this blog.

Get the answers you need: Support


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