Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generation of pdf file using java

I am developing a standalone application in Java. I want to generate a pdf file using Java code. I have a display form in which all the details are fetched from database and displayed in the window. Details are Customer Name, Order Details etc.

Now I want to have a button there which says Convert to pdf. I want to convert this to pdf file with proper alignment and formatting like tables, font etc.

What can be an ideal way to go about it?

like image 538
yashbinani Avatar asked Dec 22 '22 18:12

yashbinani


1 Answers

I'd suggest you to use reporting tool like a jasperreports.

JasperReports is entirely written in Java and it is able to use data coming from any kind of data source and produce pixel-perfect documents that can be viewed, printed or exported in a variety of document formats including HTML, PDF, Excel, OpenOffice and Word.

Have a look at other open source projects (pdf api):

  1. Apache PDFBox
  2. Apache Tika (Toolkit for detecting and extracting metadata and structured text content from various documents using POI and PDFBOX parser libs.)
  3. PDFjet
like image 79
KV Prajapati Avatar answered Jan 13 '23 10:01

KV Prajapati