Some test text!

menu
search

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

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 https://www.pdftron.com/documentation/web/guides/wv-server/ for more info. [y/n]:  n
    Will you be converting all your documents to XOD? See https://www.pdftron.com/documentation/web/guides/optimize-lib-folder 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 https://www.pdftron.com/documentation/web/guides/optimize-lib-folder for more info (most users dont need this option). [y/n]:  n
    Do you need to deploy to Salesforce? See https://www.pdftron.com/documentation/web/guides/optimize-lib-folder 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 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. (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.

    drawing

    You should see the application start up:

    drawing

For more information on how to call WebViewer API, check out this blog. Also check out the WebViewer guides and API.

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.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn more
close