文章目录
概要
java利用itextpdf导出pdf
maven包进入
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13.3</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext-asian</artifactId>
<version>5.2.0</version>
</dependency>
工具类
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfWriter;
import org.apache.commons.lang3.StringUtils;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PdfUtils {
Font fontHead = null;
Font fontKey = null;
Font fontValue = null;
Document document = null;
PdfWriter writer = null;
public PdfUtils(String path) throws DocumentException, IOException {
BaseFont bf = BaseFont.createFont("/simfang.ttf", BaseFont.IDENTITY_H
标签:java,BaseFont,导出,itextpdf,import,pdf,null,com
From: https://blog.csdn.net/weixin_44234810/article/details/141090692