Skip to main content
Participant
Jan 14, 2021 1:14 AM UTC
Answered

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

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 });
 
This topic is closed to new replies. Start a new post to keep the conversation going.
Joel Geraci
Joel GeraciCorrect answer
Community Expert
Jan 15, 2021 3:45 PM UTC

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.

8 replies

Joel Geraci
Community Expert
Joel GeraciCommunity ExpertCorrect answer
Community Expert
Jan 15, 2021 3:45 PM UTC

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.

Translate
Participating Frequently
Mar 6, 2022 5:15 PM UTC

Hi is this suppose to still works? I tried the same exact code in your pen using my brochure, but I can still see the rendering process. Am I missing something? thank you

Translate
Joel Geraci
Community Expert
Community Expert
Mar 8, 2022 3:29 PM UTC

Can you share the PDF?

Translate