AEM 6.5.21 Create PDFs from static HTML(with inline CSS) programatically as a DAM asset | Community
Skip to main content
Level 3
March 20, 2025
Solved

AEM 6.5.21 Create PDFs from static HTML(with inline CSS) programatically as a DAM asset

  • March 20, 2025
  • 4 replies
  • 717 views

In AEM 6.5.21 we require to create PDFs from static HTML(with inline CSS) programatically as a DAM asset.
We have an endpoint that gives text/html response HTML(with inline CSS).


Have tried PDFBox but it displays the html content as text in the PDF. 

Best answer by PavanGaddam

@akashdeepaem I would recommend using the  https://developer.adobe.com/document-services/docs/apis/#tag/Html-to-PDF/operation/pdfoperations.htmltopdf. and then write the asset to the DAM using the Assets API / utilities.

4 replies

arunpatidar
Community Advisor
Community Advisor
March 20, 2025
giuseppebaglio
Level 10
March 21, 2025

hi @akashdeepaem

Under the assumption of installing wkhtmltopdf on the machine running AEM, you can also test and evaluate this option:

https://experience-aem.blogspot.com/2019/06/aem-65-workflow-step-to-generate-pdf-of-sites-page-during-activation.html 

PavanGaddamAdobe EmployeeAccepted solution
Adobe Employee
March 21, 2025

@akashdeepaem I would recommend using the  https://developer.adobe.com/document-services/docs/apis/#tag/Html-to-PDF/operation/pdfoperations.htmltopdf. and then write the asset to the DAM using the Assets API / utilities.

kautuk_sahni
Community Manager
Community Manager
April 1, 2025

@akashdeepaem Did you find the suggestions helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!

Kautuk Sahni