Some test text!


Integrating WebViewer Into a Salesforce Lightning Web Component

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 and Saving Documents 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.

Join our upcoming webinar to learn about how to collaborate on videos frame by frame directly in your browser

Save your seat