How to open a document stored in Object Storage from Salesforce?

I am working on a project where PDFtron could be really useful. We have tons of files that we are planning to move to any object storage (S3, Wasabi, Azure). I want this files to be accessible in Salesforce, so users can edit, update, annotate. I did look into PDFtron’s guide on “How to open document stored in Salesforce” but that was not helpful enough since we are planning to store files in external object storage and access it in Salesforce. My question is, How can I open document in Salesforce that is stored in external object storage?

Thank you for reading my comment and for your time on the issue. Thank you!

Hi,

For anyone who is still looking into this here please refer to the summary below:

You can use loadDocument that is used in the documentation - it takes blobs, base64, arraybuffers but can also load a URL (for example from AWS S3).

You need to set up CORS on the file storage side (check this example to see how to set up in AWS S3) to whitelist your Salesforce domain. You may also need to set up CSP (when calling from LWC/JS) or RSS (when calling from Apex) to allow outgoing requests from Salesforce.

Finally, you may need to authenticate your request (f.e. by adding a customer header under loadDocumentOptions object in the loadDocument call or use a pre-signed URL, or the files need to be accessible without auth.