Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Need to generate a PDF file from a AEM wite page

Avatar

Level 1

Hi Team,

 

I do have a requirement in my current project which is based upon AEM 6.5.

I have a page which generates some useful-info( uses clientlibs for style and layout ) after collecting inputs from end user.

I want to add a button on that useful-info page for downloading that page content as a pdf file.

Can I use any OOTB plugin or open-source 3rd party plugin etc which I can use inside my pdfgeneration servlet to generate the PDF version of that page.

 

Note-: The components used here are still following classic ui approach.

 

Thanks and regards

Tapas

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi, 

The easiest way would be to "print" your page as PDF, you could use JS and do something like window.print(). Otherwise, you can simply call a servlet and do the transformation in your servlet (backend).

Please check the solution in this thread: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/convert-aem-page-to-pdf/m-... which will work for your use case as well. If you decide to use a backEnd approach, you can use any java dependency to convert to PDF, so the options are bigger. For example: https://www.baeldung.com/java-html-to-pdf 



Hope this helps.



Esteban Bustamante

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi, 

The easiest way would be to "print" your page as PDF, you could use JS and do something like window.print(). Otherwise, you can simply call a servlet and do the transformation in your servlet (backend).

Please check the solution in this thread: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/convert-aem-page-to-pdf/m-... which will work for your use case as well. If you decide to use a backEnd approach, you can use any java dependency to convert to PDF, so the options are bigger. For example: https://www.baeldung.com/java-html-to-pdf 



Hope this helps.



Esteban Bustamante