• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

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

1.5K

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

Community Expert , 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.

Votes

Translate

Translate
Community Expert ,
Jan 15, 2021 Jan 15, 2021

Copy link to clipboard

Copied

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.

Votes

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
Community Beginner ,
Mar 06, 2022 Mar 06, 2022

Copy link to clipboard

Copied

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

Votes

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
Community Expert ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

Can you share the PDF?

Votes

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
Community Beginner ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

yes of course

https://anekitalia.com/catalogo-soggiorni

I have replied exactly the same code in your codepen with my pdf brochure and ID(except that I want the view mode as SINGLE_PAGE ). You will notice for sure in the mobile version, that you can clearly see the rendering of all pages. I simply would like that the rendering phase during the scrolling not be visible, I don't care if the initial load of the pdf is longer. In the desktop version seems ok due to higher hardware performance, but if you scroll very fast you will notice the rendering even on desktops.

Votes

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
Community Expert ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

Ok - I see it now.

Votes

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
Community Beginner ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

I made a video from my android 11 device with latest chrome, you can see the rendering of the page after scrolling

https://drive.google.com/file/d/1VoH4EWXE8fUPjyssJug33reo6hkcduzx/view?usp=sharing

 

Votes

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
Community Expert ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

That looks like a memory limitation. I think Embed API is rendering as much as it can and then stops until you get to a page that hasn't been rendered. I doubt there is anything you can do about it.

Votes

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
Community Beginner ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

LATEST

thank you anyway for your support

Votes

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
Resources