Configure AEM to open PDFs inline in a new tab from DAM links
This article explains how to adjust Adobe Experience Manager (AEM) so that PDF assets linked from the Digital Asset Manager (DAM) open inline in a new browser tab rather than downloading.
Description description
Environment
Adobe Experience Manager (AEM), including AEM as a Cloud Service and AEM 6.5
Issue/Symptoms
When a PDF stored in DAM is linked from a content page, clicking the link causes the PDF to download instead of opening inline in a new browser tab.
- By default, PDFs are served with
Content-Disposition: attachment, prompting download. - The desired behavior is for selected PDFs to open inline in a new tab when clicked.
Example HTML link:
<a href="/content/dam/example.pdf" target="_blank">Open PDF</a>
Observed result: PDF downloads instead of displaying inline.
Cause
By default, AEM serves DAM PDFs with Content-Disposition: attachment for security, causing browsers to download the file. Adjusting the HTTP headers and link attributes allows selected PDFs to open inline in a new tab as desired.
Resolution resolution
Follow the steps below to resolve the issue.
-
To open a PDF in a new tab, set the
target="_blank"attribute on the link:code language-none <a href="/content/dam/example.pdf" target="_blank">Open PDF</a> -
Edit the dispatcher (Apache) configuration to set the header to
inlinefor specific PDFs or folders. -
To target a single PDF, use the following configuration:
code language-none ForceType application/pdf Header unset Content-Disposition Header set Content-Disposition inline -
To target a folder of PDFs, use the following configuration:
code language-none ForceType application/pdf Header unset Content-Disposition Header set Content-Disposition inline -
Deploy the updated configuration via Cloud Manager (for AEM as a Cloud Service) or your AMS deployment process.
-
Configure the Apache Sling Content Disposition Filter (
org.apache.sling.security.impl.ContentDispositionFilter) to allow inline rendering for selected assets. -
Refer to the Adobe documentation for filter configuration:
-
Verify that clicking the PDF link opens the document inline in a new browser tab.
Notes
- This ensures the browser opens the link in a new tab or window.
- The browser’s decision to display or download a PDF is controlled by the
Content-DispositionHTTP header. - By default, AEM serves PDFs with
Content-Disposition: attachmentfor security, causing downloads. - When viewing PDFs directly in Brand Portal, the built-in Document Viewer already opens PDFs inline. There is no separate Brand Portal setting for “open in new tab”; this is controlled by your site’s HTML and HTTP headers.