Expand my Community achievements bar.

SOLVED

Nees to genrate pdf from api data

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

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

Avatar

Community Advisor

@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

Avatar

Level 4

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 

screenshot-products.fileformat.com-2023.02.22-20_20_14.png

 

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