For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integrating Salesforce with WebViewer JavaScript PDF library

Welcome to Apryse. 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.

Get the Salesforce sample source code here

Prerequisites

spinner

For step-by-step help on setting up a Salesforce development environment, see one of the following:

License Key Required

The trial of Apryse SDK requires a trial license key, which is provided in the box titled "License Key". A commercial license key is required for use in a production environment. Please contact sales to purchase a commercial key or if you need any other license key assistance.

Initial Setup

  1. Extract WebViewer.zip.

  2. Navigate into the extracted folder and run:

  1. You will encounter the following prompts, which you should answer y/n as indicated:

Do I need to exclude optimized workers?

Because of Salesforce governor limits there is a limited file size able to be loaded and so the optimized workers need to be used. Make sure to answer "n" to whether you would like to exclude the optimized workers. More details on Salesforce governor limits.

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 in addition to the .resource-meta.xml -- this meets the requirements to safely upload to the Salesforce platform.

Do I need full PDF API?

Note that in certain circumstances, you may need the full PDF API. For more details on when you may need to enable it, please see our guide here .

  1. Next clone the webviewer-salesforce sample:

  1. 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.

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 same.

  1. 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 using an authorization method:

  1. 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.

  1. Create a scratch org using the config/project-scratch-def.json file, set the username as your default, and assign it an alias:

  1. Push the app to your scratch org:

Run the sample

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

  1. A browser will open where you should click the app launcher icon in the top left, and select Apryse.

You should see the application start up:

Extending the sample

See our Salesforce overview page for information on how to follow our general WebViewer guides when WebViewer is integrated into Salesforce.

Next step

UsageGuidesSamplesAPI docs

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

Last updated

Was this helpful?