Since JText 2.1.7 is the last commercial-free version, I wappered and provied a easy way to use JText 2.1.7 and HTML-style template for generating report.
<dependency>
<groupId>com.github.jawf</groupId>
<artifactId>reportj</artifactId>
<version>1.1</version>
</dependency>
- Generate Pdf to Path:
XhtmlPdfGenerator.getInstance().generatePdfToPath("report/template/test.ftl", model, "d:/test.pdf");
- Generate Pdf and stamper it, output to path:
InputStream is = XhtmlPdfGenerator.getInstance().generatePdfToInputStream("report/template/test.ftl", model);
PdfWrappedStamper.getInstance().stampToPath(is, "d:/test_.pdf");
<repositories>
repository>
<id>oss</id>
<url>https://oss.sonatype.org/content/groups/public</url>
</repository>
</repositories>
- Css file may not be rightly loaded in spring-boot project, please use style content within template file instead.
##Implementation for this project with Maven dependencies:
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<!-- html template render -->
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-core</artifactId>
<version>9.0.7</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf</artifactId>
<version>9.0.7</version>
</dependency>
<!-- freemarker engine -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
Sample 1:
Sample 2:
Sample 3:
Sample 4:
Sample 5:
Sample 6: