Nees to genrate pdf from api data | Community
Skip to main content
Level 3
Feb 22, 2023 1:22 PM UTC
Solved

Nees to genrate pdf from api data

Hi Team,

 

Can you please help us to provide any java library or link which will help to create the PDF of the API data.

 

Thanks

Bhagchand Saini

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Shiv_Prakash_Patel
Shiv_Prakash_PatelAccepted solution
New Participant
Feb 22, 2023 1:56 PM UTC

Hi @bhagchand ,

If please check out this if it can help  - https://medium.com/javarevisited/html-to-pdf-in-java-using-flying-saucer-f73b70d9014d

Regards

Shiv

 

Shiv Prakash

5 replies

Umesh_Thakur
New Participant
Feb 22, 2023 2:38 PM UTC

@bhagchand , which kind of data API will return?

If it is just text, going to be very simple and you have lots of option available(paid or free). But if it is HTML, you have very limited options specially when it comes to css application for styling. Simple styling is very easy but converting entire html to pdf is tough. some time JSOUP is also handy in html to pdf conversion but based on your use case.s

vailable options are OpedPDf, flying saucer, itext an all. 

 

Hope this helps

Umesh Thakur

Translate
bhagchandAuthor
Level 3
Feb 22, 2023 2:51 PM UTC

Hi Umesh, 

 

When we submit form then that form data will be download as pdf from the aem servlet. I have tried the openPDF  with the code 

 

But there was error due to creating object in service 

Document document = new Document();

 

Please help to suggest any way to resolve this issue

 

Thanks 

Translate
Umesh_Thakur
New Participant
Feb 24, 2023 3:52 AM UTC

can you share the log trace?

Translate
Shiv_Prakash_Patel
Shiv_Prakash_PatelAccepted solution
New Participant
Feb 22, 2023 1:56 PM UTC

Hi @bhagchand ,

If please check out this if it can help  - https://medium.com/javarevisited/html-to-pdf-in-java-using-flying-saucer-f73b70d9014d

Regards

Shiv

 

Translate
Shiv Prakash
bhagchandAuthor
Level 3
Feb 22, 2023 2:51 PM UTC

Hi @shiv_prakash_patel ,

 

Let me check thanks !!!

Translate