Nees to genrate pdf from api data | Community
Skip to main content
New Participant
February 22, 2023
Solved

Nees to genrate pdf from api data

  • February 22, 2023
  • 2 replies
  • 1240 views

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.
Best answer by Shiv_Prakash_Patel

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

 

2 replies

Umesh_Thakur
New Participant
February 22, 2023

@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

bhagchandAuthor
New Participant
February 22, 2023

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 

Umesh_Thakur
New Participant
February 24, 2023

can you share the log trace?

Shiv_Prakash_Patel
Shiv_Prakash_PatelAccepted solution
New Participant
February 22, 2023

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
bhagchandAuthor
New Participant
February 22, 2023

Hi @shiv_prakash_patel ,

 

Let me check thanks !!!