Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Failed to load PDF document

Avatar

Level 2

Has anyone experienced an issue with Chrome when attempting to reference a PDF in AEM author/publisher?

We built a new internal website with an Author and Publisher only. The site is a clone of our live site (in terms of code / content - no dispatcher tho) but whenever we attempt to click a hyperlink to a PDF asset on the rendered site, we get the following error "failed to load PDF document".

I can validate that

A) This only happens in Chrome (chrome in browser plugin obviously).

B) Does not happen in other browsers.

C) I can successfully direct access pdf's in Chrome (in browser plugin) from other websites.

D) I can direct access pdf's in Chrome (in browser plugin) on our live site.

E) We only have auth / pub in the new environment - but we do have a dispatcher in the live environment (where it works)

My only thought is this is somehow related to a mime-type or document setting not set correctly on our new internal website... but knowing that our live environment has the mime types set in the dispatcher.any file - is there a way to do the same for the auth/pub on the new site? (via Apache maybe?).

Or is there something else that I am missing that is creating this error?

Thx

3 Replies

Avatar

Employee

As a first step in debugging this:

1. Use the browser developer tools panel to see what the "Content-Type" header is set to when the file is served from AEM versus other sites where you see it working.

2. What URL are you serving the PDF from? To help you be able to capture the network request in the browser do the following:

a. Open chrome://settings/content/pdfDocuments in the Chrome browser and enable this feature to make it download the pdf instead of opening it.

b. Open a new browser tab and open developer tools then copy / paste the PDF document URL.

c. See what Content-Type header value and other headers you get back.  This will help you debug the cause.

Avatar

Level 2

Interesting.

Thanks for your suggestions.

Per #1 above, I do see a slight difference between the site that works, and doesnt.

The site that does work has a Response Header : "content-type: application/pdf" value in Dev tools

The site that doesnt work has a Response Header : "Content-Type: [Content-Type: application/pdf  ]" value.

I'll have to look into why the key and value are both different (case sensitivity and the extra Content-Type as part of the value)

Per #2 above

For the broken one, I am serving the PDF from the publisher. (the pdf content resides in the dam)

I was able to download the file after changing chrome settings - however, the Response Header had the same value:

Content-Type: [Content-Type: application/pdf  ]"  So this just confused me more....

Avatar

Level 2

Re-opening this:

We created a workaround - and until the time being - all was good.
However, we are still having issues with users who 'direct link' to our PDFs using Chrome.

PDF's work on our author environment (direct link) - however once we publish - we experience the issue.
Thinking this is either related to a Dispatcher setting?

Any help appreciated.