Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Nees to genrate pdf from api data

Avatar

Level 3

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
Level 5

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

 

5 Replies

Avatar

Correct answer by
Level 5

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

 

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 3

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