Some test text!

menu
Salesforcekeyboard_arrow_down

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.

linkPrerequisites

  • Salesforce CLI
  • Visual Studio Code with Salesforce Extensions
  • WebViewer:

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

No trial license key required.
The trial of PDFTron 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).

linkInitial Setup

  1. Extract WebViewer.zip.
  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? [y/n]:  n
    Will you be converting all your documents to XOD? [y/n]:  n
    Do you need client side office viewing support? [y/n]:  y
    Do you need the full PDF API? [y/n]:  n
    Do you need to deploy to Salesforce? [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 https://github.com/PDFTron/webviewer-salesforce.git
  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.

    drawing

  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 to the lightning experience setup page. Enable devhub by typing dev hub in the quick find search and toggle to enable as shown in the picture below.

salesforce-devhub-enable

  1. 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
  2. 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 in the top left, and select PDFTron.

    drawing

    You should see the application start up:

    drawing

linkNext step

GuidesSamplesAPI docs

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

Get the answers you need: Support

close

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.