Convert AEM page to PDF

Avatar

Avatar

Love_Sharma

Avatar

Love_Sharma

Love_Sharma

29-07-2018

Hi all,

I want to convert AEM html page to Pdf (using AEM 6.4)  and a link will be provided to users for to download that Pdf.

I have gone through forum already and found sources which I don't want to use like PDF generator (need licence Adobe Acrobat)  , PDFbox API (some restriction with JavaScript on the page)  and iTextpdf (need to expose code which I can't).

Could anyone share approach what else could be used (best if that is free).

Thanks in advance

Sharma

View Entire Topic

Avatar

Avatar

sachinarora

Avatar

sachinarora

sachinarora

04-08-2018

I have an approach which might work.You have to do 2 things in it.

1. As you have mentioned a link will be provided to users, you can add a query parameter in URLs of a page like /home.html?print=page. In Javascript you can give a condition to run window.print() in case print == page.It will automatically pop up a window for user to save it as PDF or print page.

2. Add media rule in CSS for print to control content that needs to be added in PDF. Reference URL