Intermittent PDF viewing

Community Beginner ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

Hi.

When I open a incognito page the pdf doesn't show at the first time.

Taking a look at the DOM, The iframe is not loaded (just the first time), just the div that supuse to have the iframe is there.

 

https://i.gyazo.com/c3083ef381a2391fe104a1c60f6c05b3.png

 

I checked the Network tab and Console tab on the web dev tools but is not showing me any error.

I set up the event called "APP_RENDERING_FAILED" but isn't catching nothing.

 

https://i.gyazo.com/cbc6e4736a73d8b641db77818cf0e5bb.png

 

Exist a event to know if the Pdf had troubles and a way to init the "render" again?

 

 

 

TOPICS
PDF Embed API

Views

110

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 Employee , Dec 03, 2020 Dec 03, 2020
You can check the PDF Embed API initialization in the following way as well if (window.AdobeDC) { previewFile(); } else { /* Wait for Adobe Document Services PDF Embed API to be ready */ document.addEventListener("adobe_dc_view_sdk.ready", () => { previewFile(); }); } Hope this will help your cause. 

Likes

Translate

Translate
Adobe Community Professional ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

Can you share your code?

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
Community Beginner ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

This is whole my implementation.

https://i.gyazo.com/52b0428f4ac7b587ee4480513078598a.png

It only fails the first time.

Thank you

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
Adobe Community Professional ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

Put everything you have inside a document.ready event callback. I suspect the Embed API is ready before the HTML is fully loaded and it can't find the div you reference.

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
Community Beginner ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

Hi Joel

Thank you so much for the support.

That makes sense to me. 

I did it but Now the listener "adobe_dc_view_sdk.ready" is not being trigered anymore.

See my gif.

https://i.gyazo.com/394d21b04efc073ce2c2708f4acf6e2f.gif

I have not console errors that could obstruct the flow.

I will wait for you response.

Thank you.

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
Adobe Community Professional ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

The video is too small for me to see. Can you try recapturing it?

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
Community Beginner ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

This is the same gif but with better quality.

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
Community Beginner ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

If you want I cant share you by private my QA enviroment where i have implemented my code.

That works for you?

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
Adobe Employee ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

You can check the PDF Embed API initialization in the following way as well

            if (window.AdobeDC) {
                previewFile();
            } else {
                /* Wait for Adobe Document Services PDF Embed API to be ready */
                document.addEventListener("adobe_dc_view_sdk.ready", () => {
                    previewFile();
                });
            }

Hope this will help your cause. 

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
Community Beginner ,
Dec 04, 2020 Dec 04, 2020

Copy link to clipboard

Copied

LATEST

It works.

Thank you so much.

 

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