Hi everyone,
we need to create a PDF in AEM.
I don' t think there is an out of the box way / library to do it, but I may be wrong.
I have seen some old answers but the links to the solutions are not available anymore.
We don' t use AEM Forms on our instances and I don' know how hard it is to add it.
Anyway let me explain some details about the functionality creation we have to implement.
Basically the user compiles an html form and submits. An Ajax request is performed. We already have a service that does some business logic when called.
If submit is successful, in one div of the page just appears a text that confirms successful elaboration.
Now the idea is to show also a button to print a PDF based on a given template in which we should put some of the input entered by the user.
Which is the best solution ? Should we use a back end creation with a library like JasperReports / iReport ?
Or should we implement a client side solution with some Javascript library ?
Consider that at the moment we don' t have a web page that we can convert to PDF and that PDF file should have a header with company logo in each page. Maybe PDF file won' t be more than 2 pages long but one page is not enough.
We are also thinking about loading an html template on DAM, replacing some placeholders with user submitted data and converting it to pdf and of course serve it as a response.
I hope the requirements are clear.
Thanks in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
It's a complex question to select proper technology. It depends on your use cases. Below you can find options that you can discover:
Recommended Library:
How to implement:
Pros:
Cons:
Recommended Library:
How to implement:
Pros:
Cons:
Steps:
Pros:
Cons:
Backend generation (iText or similar) is ideal for your scenario because:
If you prefer client-side generation, html2pdf.js is a good option but may have limitations in handling logos and multi-page PDFs.
Best regards,
Kostiantyn Diachenko.
It's a complex question to select proper technology. It depends on your use cases. Below you can find options that you can discover:
Recommended Library:
How to implement:
Pros:
Cons:
Recommended Library:
How to implement:
Pros:
Cons:
Steps:
Pros:
Cons:
Backend generation (iText or similar) is ideal for your scenario because:
If you prefer client-side generation, html2pdf.js is a good option but may have limitations in handling logos and multi-page PDFs.
Best regards,
Kostiantyn Diachenko.
Hi Konstantin,
thanks a lot for your reply, I will evaluate the solutions.
Bye.
Views
Replies
Total Likes
Hi Konstantin,
I have to say that I don' t really understand the difference between solution 1 and 3.
I mean both make use of an html template loaded on DAM, and can use a library like iText.
Views
Replies
Total Likes
Yes, they are almost the same. Using iText should be good in your case.
Views
Likes
Replies