How to preload PDF to avoid layered rendering using the DCSDK?

New Here ,
Jan 13, 2021 Jan 13, 2021

Copy link to clipboard

Copied

The documentation for the DCSDK shows that you can specify a url to load a PDF, but the rendering is very slow and causes 1 layer at a time to be rendered.  We are displaying watermarked documents, so we don't want to have a half second where the watermark is not visible during rendering process.  Is there a way to pre-render before showing the document or potentially load from memory instead of from a url?

 

The documentation say you can use a File blob by specifying a promise, but I see no code examples.  I was hoping I could retrieve the PDF bytes from a server and then pass it to the PDF library to render and perhaps speed up the render process.

 

let adobeDCView = new AdobeDC.View({ clientId: clientId, divId: "adobe-dc-view" });

adobeDCView.previewFile({
    // content: { location: { url: "server.com/my_file.pdf" } }, // works but slow render
    content: { promise: promise }, // does not work when resolving this promise with a Blob of type 'application/pdf'
    metaData: { fileName: "my_file.pdf" }
}, { showAnnotationTools: false, showDownloadPDF: false, showPrintPDF: false });
 
TOPICS
How to, PDF Embed API

Views

176

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Jan 15, 2021 Jan 15, 2021
I have an example of loading a PDF from a Promise and then waiting until APP_RENDERING_DONE fires before displaying the PDF. It also shows how to display your own loading animation during that time. Look at this CodePen.

Likes

Translate

Translate
Adobe Community Professional ,
Jan 15, 2021 Jan 15, 2021

Copy link to clipboard

Copied

LATEST

I have an example of loading a PDF from a Promise and then waiting until APP_RENDERING_DONE fires before displaying the PDF. It also shows how to display your own loading animation during that time. Look at this CodePen.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines