Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
SOLVED

Open Content Asset PDF in New Tab Without Downloading

Avatar

Level 2

Hi all,

I'm working in AEM and need to add a link (<a href>) on a page that points to a PDF stored in the DAM. The requirement is for the PDF to open in a new browser tab or in the same window, rather than triggering a download.

Is there a simple or recommended way to achieve this in AEM? Ideally, I’d like to avoid any custom code if possible and use core components.

 

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @aa_w ,

Step 1: Use <a> with target="_blank" and direct DAM URL

In your component (text, teaser, or button), use a simple anchor tag like:

<a href="/content/dam/your-site/path-to-file.pdf" target="_blank" rel="noopener noreferrer">
  View PDF
</a>

Step 2: Confirm the Asset in DAM Has Correct MIME Type

  - Go to CRXDE Lite.

  - Path: /content/dam/your-site/path-to-file.pdf/jcr:content/metadata

Confirm:

dc:format = application/pdf

This tells the browser it's a displayable PDF.

If It Still Triggers Download Instead of Opening

This is usually due to Dispatcher/Apache headers. Here's what to check:


Apache/Dispatcher Configuration

In your Apache config (or dispatcher/src/conf.d/available_vhosts/*.conf):

<FilesMatch "\.pdf$">
   Header set Content-Disposition "inline"
</FilesMatch>

Use with Core Components (Text/Teaser/Button)

You can:

  - Use the Text Core Component and add <a href="..."> HTML directly.

  - Use the Button Core Component and configure the Link URL to the DAM PDF.

        - Make sure you check the "Open in new tab" option.


If You Want to Embed the PDF (instead of open in new tab):

Use an <iframe> (inside an Embed Core Component):

<iframe src="/content/dam/your-site/sample.pdf" width="100%" height="800px" style="border: none;"></iframe>

For advanced rendering with page controls (zoom, search), integrate PDF.js viewer:

<iframe src="/etc.clientlibs/your-project/pdfjs/web/viewer.html?file=/content/dam/your-site/sample.pdf" width="100%" height="800px"></iframe>

 
Regards,
Amit

View solution in original post

5 Replies

Avatar

Level 3

Hi @aa_w ,

 

 There is no direct OOTB solution for this. You can use core embed component along with iframe to render the pdf on a page.

<iframe src="/content/dam/your-site/sample.pdf" width="100%" height="800px" style="border: none;"></iframe>

 For better cross-browser support, use a custom PDF.js viewer. and you can embed a full PDF.js viewer into the iframe using:

 

<iframe src="/etc.clientlibs/your-project/pdfjs/web/viewer.html?file=/content/dam/your-site/sample.pdf" width="100%" height="800px"></iframe>

 

Avatar

Community Advisor

Hi @aa_w,

1. AEM Configuration: Set Correct MIME Type

Ensure AEM is delivering the correct Content-Type for PDFs:

  • When a PDF is uploaded to DAM, AEM automatically sets the MIME type to application/pdf.

  • This instructs the browser to attempt to display the PDF inline (in a tab) rather than download it.

You can verify this in CRXDE at the PDF asset node (e.g., /content/dam/yourfolder/yourfile.pdf) — make sure the jcr:content/metadata/dc:format is set to application/pdf.

If needed, reprocess the asset or manually set it.

2. Dispatcher Configuration: Allow PDF MIME Type

The Dispatcher (Apache) must not force a download via headers.

Check the Apache configuration (or dispatcher.any includes) to ensure it does not set the Content-Disposition: attachment header for PDFs.

Instead, explicitly allow inline rendering:

<FilesMatch "\.pdf$">
   Header set Content-Disposition "inline"
</FilesMatch>

Or remove any configuration that sets Content-Disposition: attachment globally, especially for PDFs.

References: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/pdf-from-dispatchers-shoul...

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/pdf-view-and-download-issu...

 

Hope that helps!


Santosh Sai

AEM BlogsLinkedIn


Avatar

Community Advisor

Hi @aa_w 

No code solution - use download core component

Code Solution -

1. Modify a link component or add a metadata to assets which can be used to identify to generate downloadable links e.g. www.mysite.com/content/dam/myprj/mydata.download.pdf, if pdf needs to be dowloaded then add download selector otherwise none to open in browser.

2. Add CONTENT_DISPOSITION_HEADER, "attachment; filename="file_name_1" header from dispatcher based on the rule which says if pdf path includes .download.pdf

 

If you need a rule for all PDFs within a site then you don't need step1 and rule in step2 would be .pdf

 

Arun Patidar

AEM LinksLinkedIn

Avatar

Level 4

Hi @aa_w,

I hope the answer shared above helped address your question. If it did, please mark it as "correct", this helps others in the community find helpful solutions more easily.

If you’re still facing any challenges, please feel free to continue the conversation here. We’re happy to support further.

Avatar

Correct answer by
Community Advisor

Hi @aa_w ,

Step 1: Use <a> with target="_blank" and direct DAM URL

In your component (text, teaser, or button), use a simple anchor tag like:

<a href="/content/dam/your-site/path-to-file.pdf" target="_blank" rel="noopener noreferrer">
  View PDF
</a>

Step 2: Confirm the Asset in DAM Has Correct MIME Type

  - Go to CRXDE Lite.

  - Path: /content/dam/your-site/path-to-file.pdf/jcr:content/metadata

Confirm:

dc:format = application/pdf

This tells the browser it's a displayable PDF.

If It Still Triggers Download Instead of Opening

This is usually due to Dispatcher/Apache headers. Here's what to check:


Apache/Dispatcher Configuration

In your Apache config (or dispatcher/src/conf.d/available_vhosts/*.conf):

<FilesMatch "\.pdf$">
   Header set Content-Disposition "inline"
</FilesMatch>

Use with Core Components (Text/Teaser/Button)

You can:

  - Use the Text Core Component and add <a href="..."> HTML directly.

  - Use the Button Core Component and configure the Link URL to the DAM PDF.

        - Make sure you check the "Open in new tab" option.


If You Want to Embed the PDF (instead of open in new tab):

Use an <iframe> (inside an Embed Core Component):

<iframe src="/content/dam/your-site/sample.pdf" width="100%" height="800px" style="border: none;"></iframe>

For advanced rendering with page controls (zoom, search), integrate PDF.js viewer:

<iframe src="/etc.clientlibs/your-project/pdfjs/web/viewer.html?file=/content/dam/your-site/sample.pdf" width="100%" height="800px"></iframe>

 
Regards,
Amit