When saving documents in Salesforce, there are two approaches, depending on the file size. For smaller documents, you can store them directly in Salesforce using the standard ContentVersion
object, allowing for easy retrieval and integration within Salesforce records. However, for larger files, Salesforce governor limits(6MB/12MB async) and file size restrictions prevent direct storage.
We recommend using an External Storage Solution, where the document is uploaded to an external system (e.g., AWS S3, Azure Blob Storage), and only a reference (such as a URL or identifier) is stored in Salesforce. This ensures large documents can still be accessed through Salesforce without hitting platform limits, providing flexibility for both standard and large file use cases.
You can store small files directly in Salesforce because they stay within the platform’s storage and memory limits.
Note: We recommend a review of the Overview page to learn how to correctly use a config.js
before getting started using Webviewer.
The process of saving a document to Salesforce begins with WebViewer, where you:
postMessage
to a Salesforce Lightning Web Component (LWC) that listens for incoming messages.ContentVersion
object using the received data and inserts it into the Salesforce database.When you save a document to Salesforce, a function, message, and method work to save the document within Salesforce.
The saveDocument
function prepares a document to be saved in Salesforce through the following process:
postMessage
; otherwise, it triggers a fallback download.When a trusted message of type "SAVE_DOCUMENT"
is received, the following process happens:
saveDocument
Apex method, passing the document data and related record ID.The saveDocument
method in the Apex controller handles saving an annotated document into Salesforce by using the following process:
PDFTron_ContentVersionPayload
object.ContentVersion
record using the provided ID (cvId) to find the associated ContentDocumentId
.ContentVersion
record that includes the annotated file (decoded from Base64), and insert it as a new version of the existing document.ContentDocumentId
) and a related record ID is provided, create a ContentDocumentLink
to associate the uploaded document with a specific Salesforce record.ContentVersion
or, throws an AuraHandledException if an error occurs.Large files must be stored externally because they exceed Salesforce’s processing and storage limits, while smaller files can be stored directly in Salesforce without issue since they stay within the platform’s governor limits for file size and memory usage. Leveraging external storage provides more flexibility for handling large files while still integrating with Salesforce workflows.
When you want to save a larger document to Salesforce, you must save it to an external storage solution like AWS S3, then relate the file to its Salesforce record.
Our Salesforce integration supports an external storage solution. Instead of uploading the full PDF file into Salesforce, you can:
This hybrid approach combines Salesforce’s strengths in record-keeping and workflow with the scalability of external storage systems—ensuring performance, compliance, and usability for flexible document workflows.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales