Foreword Use the word template to generate the file, as shown in the figure below, generate the template on the left as the filled word document on the right. How to operate Introduce dependencies <!– https://mvnrepository.com/artifact/com.itextpdf/itextpdf –> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId> <version>5.5.13.3</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.1.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.1.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-excelant</artifactId> […]
Tag: itextpdf
(Java) convert aspose to pdf, itextpdf adds watermark to pdf, and supports POI template (including checkbox) export
Directory 1. Import the jar package 2. PDF processing tools 3. Poi template export tool class 4. Test class 5. Template 6. The final effect 1. Import jar package 2, pdf processing tool class import com.aspose.cells.PdfSaveOptions; import com.aspose.cells.Workbook; import com.aspose.words.Document; //Introduce aspose-words-21.5.0-jdk17 package import com.aspose.words.*; import com.itextpdf.text.*; import com.itextpdf.text.pdf.*; import javax.swing.JLabel; import java.awt.FontMetrics; import java.io.*; […]
Java integrates itextpdf to generate pdf by filling data in pdf template
Article directory 1. Make a pdf template 1.1, use excel to make a table 1.2, convert to pdf 1.3, set the form field 2. Introducing POM dependencies 3. Code implementation 3.1. Tools 3.2, entity object 3.3、Controller 1. Make a pdf template 1.1, use excel to make a table 1.2, convert to pdf I use the […]
Springboot integrates itextpdf to generate Pdf
package com.example.demo; import com.itextpdf.text.*; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; import java.io.FileOutputStream; class DemoApplicationTests { public static void main(String[] args) throws Exception { // Create a new document Document document = new Document(); // Create a writer (Writer) associated with the document object, and the document can be written to disk through the […]
java html to pdf itextpdf
import com.itextpdf.text.pdf.BaseFont; import org.xhtmlrenderer.pdf.ITextFontResolver; import org.xhtmlrenderer.pdf.ITextRenderer; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStream; /** * File format conversion tool class * */ public class FileTypeConvertUtil { /** * Convert HTML to PD format files. The format of the html file is relatively strict * @param htmlFile * @param pdfFile * @throws Exception */ // […]
springboot integrates itextpdf
1. Related dependencies <!– itextpdf –> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itext-asian</artifactId> <version>5.2.0</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId> <version>5.5.13</version> </dependency> 2. Font library The root path of font storage, win defaults to ‘C:\Windows\Fonts\’, missing fonts can be copied from here, or other special fonts It is very troublesome to specify the local directly. If you deploy to the server, […]
Practical application of java itextpdf
The effect looks like this Import dependencies <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId> <version>5.5.9</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itext-asian</artifactId> <version>5.2.0</version> </dependency> Tool class package com.globex.download; import com.globex.MathOperUtil; import com.globex.seller.dto.TeContract; import com.globex.seller.dto.TeContractItem; import com.globex.seller.dto.TjmSeller; import com.globex.seller.dto.TsoOrderitemUs; import com.globex.seller.vo.DownLoadOrderVo; import com.globex.system.logic.Parameter; import com.itextpdf.text.*; import com.itextpdf.text.pdf.*; import com.itextpdf.text.pdf.draw.DottedLineSeparator; import com.itextpdf.text.pdf.draw.LineSeparator; import dev.fpxgroup.common.utility.DateUtility; import dev.fpxgroup.common.utility.Globals; import freemarker.template.TemplateException; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; […]
itextpdf generates pdf based on pdf form template filling
itextpdf generates pdf based on pdf form template filling Template creation Example: Create a template using adobe acrobat tools Take excel to generate a form template as an example 1. Create a form excel 2. Create a new PDF form template Open the pdf tool: File -> Create -> Create Form Select the created excel […]
itextpdf, freemarker and flying-saucer-pdf implement PDF export function
Directory Directory 1. Import maven 2. Code structure? Edit 3. Plain text generation method JavaToPdfHtml template.html The simhei.ttf font file is downloaded from Baidu 4. Based on the freemarker template engine JavaToPdfHtmlFreeMarker templateF.html 5. Based on the advanced features of CSS JavaToPdfHtmlFreeMarkerCss templateFCss.html Font files and picture files to download from Baidu calibri.ttf, simsun.ttc, logo.png […]