Generating a pdf file using java

I am developing a standalone Java application. I want to generate a PDF file using Java code. I have a display form in which all data is retrieved from the database and displayed in a window. Details: customer name, order information, etc.

Now I want to have a button there that says Convert to pdf. I want to convert this to a pdf file with the correct alignment and formatting, for example, tables, font, etc.

What could be the perfect way to do this?

+4
source share
2 answers
+4
source

I suggest you use a reporting tool like jasperreports .

JasperReports is fully written in Java, and it can use data from any data source and create pixel-perfect documents that can be viewed, printed or exported to various document formats including HTML, PDF, Excel, OpenOffice and Word.

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

  • Apache PDFBox
  • Apache Tika (A toolkit for detecting and extracting metadata and structured text content from various documents using POI and PDFBOX analytic folders.)
  • Pdfjet
+7
source

Source: https://habr.com/ru/post/1336659/


All Articles