Some test text!
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.
For step-by-step help on setting up a Salesforce development environment, see one of the following:
Navigate into the extracted folder and run:
npm run optimize
You will encounter the following prompts, which you should answer y/n as indicated:
Optimize: Will you be using WebViewer Server? See https://www.pdftron.com/documentation/web/guides/wv-server/ for more info. [y/n]: n Optimize: 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 Optimize: Do you need client side office support (docx, pptx, xlsx)? [y/n]: n Optimize: Do you need client side office support for legacy office files (doc, ppt, xls)? [y/n]: n Optimize: 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 Optimize: Do you want to use the production version of PDFNet.js? The production version does not have type checking and console messages, but is much smaller than the development version. [y/n]: n Optimize: 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
Note that this optimization produces
.zip files of no more than 5 mb in size in addition to the
.resource-meta.xml -- this meets the requirements to safely upload to the Salesforce platform.
fullAPI = false;
Next clone the
git clone https://github.com/PDFTron/webviewer-salesforce.git
.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.
Note how every
.zip file, and the
myfiles/ directory, has a corresponding
.resource-meta.xml file, wherein the contents of each
.xml file are the
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 -a DevHub
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.
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 -s -f config/project-scratch-def.json -a my-scratch-org
Push the app to your scratch org:
sfdx force:source:push -f
Make sure you are still in the cloned project. Open the scratch org:
sfdx force:org:open -a my-scratch-org
A browser will open where you should click the app launcher icon in the top left, and select
See our Salesforce overview page for information on how to follow our general WebViewer guides when WebViewer is integrated into Salesforce.
Get the answers you need: Support