170120. How Java generates tables in PDF

Source: Internet
Author: User
Tags naming convention

1. Target

Generate a table of variable headers in a PDF and populate it with data. Dynamically generated tables are achieved by dynamically acquiring data through a get method that dynamically gets the entity class (which I am the user) through a generic dynamic generation header.

Generate a folder every day to store the generated PDF file (the name of the folder is the date timestamp), such as: 20151110

The resulting file may be in the millisecond level, so the file naming convention is "timestamp-uuid to milliseconds", such as: 20151110100245690-ece540e5-7737-4ab7-b2d6-87bc23917c8c.pdf

Gets the file store's following directory dynamically by reading the properties file. Get ways to view: http://www.cnblogs.com/0201zcr/p/4700418.html

2. Required Jar

Here, the PDF is generated via the Itex plugin, and the required jar includes the following

3. Code implementation

1), Entity class



2), properties file
3), read the properties file, get the path of PDF storage

4), get the file path that exists on the current day, create a new folder if it does not exist
5), the name of the generated file
6), generate PDF






7), evaluation function
8), test results

9), the contents of the document are as follows

4. Other RELATED LINKS

Generate Variable Header excel:http://www.cnblogs.com/0201zcr/p/4950619.html

Read excel:http://www.cnblogs.com/0201zcr/p/4656779.html

170120. How Java generates tables in PDF

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.