Some test text!


Integrating WebViewer Into a Salesforce Lightning Web Component

This guide will help you integrate a free trial of WebViewer into your Salesforce org.


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

linkMaking Web Guides applicable to your Salesforce needs

Many of the Web guides you will find about how to extend WebViewer to fit your needs is applicable to a Salesforce deployment, though there are some key differences to be aware of:


The WebViewer deployment in Salesforce requires that any extended logic be placed into the config.js file.

Additional reading about config.js

linkEquivalent of the Instance Callback Parameter

Most of the WebViewer examples will assume access to the instance callback parameter:

  // ...
  .then(instance => {
    // instance will be undefined in a Salesforce deployment!

In a Salesforce deployment, the equivalent of instance is readerControl.

Here are some examples from our guides translated to a Salesforce deployment

linkCreating a Rectangle Programmatically

The original guide can be found here

// config.js
window.addEventListener('documentLoaded', async () => {
  const { docViewer } = readerControl;
  const annotManager = await docViewer.getAnnotationManager();
   * Global namespace is accessible from config.js, hence why `Annotations` does
   * need to be de-structured from readerControl
  const rectangleAnnot = new Annotations.RectangleAnnotation();
  rectangleAnnot.PageNumber = 1;
  // values are in page coordinates with (0, 0) in the top left
  rectangleAnnot.X = 100;
  rectangleAnnot.Y = 150;
  rectangleAnnot.Width = 200;
  rectangleAnnot.Height = 50;
  rectangleAnnot.Author = annotManager.getCurrentUser();

  // need to draw the annotation otherwise it won't show up until the page is refreshed

linkHiding Elements of the UI

The original guide can be found here

// config.js
window.addEventListener('viewerLoaded', async () => {
  readerControl.disableElements([ 'leftPanel', 'leftPanelButton' ]);


linkOpening a Document Saved In Salesforce

Opening Documents In Salesforce

linkSaving Document Annotations in Salesforce

Saving Annotations In Salesforce

linkDocument Search in Salesforce

Document Search In Salesforce

linkDocument Redaction in Salesforce

Document Redaction In Salesforce

linkReplace Document Text in Salesforce

Replace Text in Salesforce

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.