Hello Team,
Since AEM (6.5 in my case) by default downloads DAM PDFs.
We added below lines and we can view PDFs upon clicking.
<LocationMatch "\.(?i:pdf)$">
ForceType application/pdf
Header set Content-Disposition inline
</LocationMatch>
PROBLEM:
We also have to give way to download as an option. so for that, created Servlet (Code Below) and set Content-Disposition as "attachment". When we try to access PDF using "docdown" selector directly from Publish Machine, It downloads.
where as from Dispatcher URL, It always show "inline" and It does not download, always open in view mode.
Code Below:
@SlingServletResourceTypes(resourceTypes = "dam:Asset", methods = HttpConstants.METHOD_GET, selectors = "docdown", extensions = "pdf")
@ServiceDescription("Download PDF Servlet")
public class DownloadPDFServlet extends SlingSafeMethodsServlet {
Solved! Go to Solution.
Views
Replies
Total Likes
We fixed using below:
<LocationMatch "^((?!docdown).)*\.pdf$">
ForceType application/pdf
Header set Content-Disposition inline
</LocationMatch>
We fixed using below:
<LocationMatch "^((?!docdown).)*\.pdf$">
ForceType application/pdf
Header set Content-Disposition inline
</LocationMatch>
@arvind Tthank you for sharing the solution with the AEM community. This would help the community in posterity.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies