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