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

Opening a document from the Salesforce Database

If you have a document uploaded into your instance of Salesforce, it will have a record in the database in the ContentVersion table. The ContentVersion object allows for versioning of the ContentDocument which is linked to a Salesforce record via the ContentDocumentLink.

For Salesforce files smaller than 25 MB, you can use this method to retrieve and display them in WebViewer.

Process Flow

small file process flow

ContentVersionController.cls

ApryseWvInstance.js

config_apex.js

When working with Salesforce files that are 25 MB or larger, attempting to load the file’s VersionData will trigger an Apex memory error. To avoid this issue, you have two options:

  1. Store the files externally in a system like Amazon S3

  2. Use a proxy server to retrieve large files directly from Salesforce

In this guide, we’ll focus on the proxy server option.

Process Flow

large files process flow

ContentVersionController.cls

ApryseWvInstance.js

config_apex.js

Proxy

This is a sample proxy server using express.

Converting a base64 string to blob inside your WebViewer LWC

Code sample

You can find a full code sample that implements opening documents in Salesforce on our Github repository.

Last updated

Was this helpful?