2021-06-06 Export PDF java

background

Recently, I made a second opening of an old project using jsp. It is necessary to add a table to export the function of PDF

Way

Export PDF is mainly divided into:
front-end export:
jspdf, html2canvas (low definition quality)
back-end export: iText5

requires attention

The jspdf export needs to deal with the problem of Chinese garbled characters. There are solutions on the Internet, but I may not find a suitable js file, and it has not been successful.

iText5 export, you need to set the padding value to adapt to the height of the table

recommend

The front-end export solution is the most lightweight and has no pressure on the server.
In terms of implementation, the background export is currently the simplest, because the front-end needs to solve Chinese garbled characters.
Time is limited and the background export is finally adopted. It is recommended that friends who have time can try the following:
jsPDF export html to pdf content truncation ultimate solution
to solve jspdf Chinese garbled characters and table Chinese garbled characters! -Final version! !
Generate PDF scheme based on front-end technology

Guess you like

Origin blog.csdn.net/qq_39879542/article/details/117632245