一、依赖引用
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>html2pdf</artifactId>
<version>7.1.15</version>
</dependency>
二、代码逻辑
public static void main(String[] args) {
// 中文和英文的格式
String html = "<html><head></head><body><h1>Hello World!测试中文</h1><p>This is an example of HTML to PDF conversion. 测试中文</p></body></html>";
String pdfPath = "D://htmlToPdf.pdf";
File file = new File(pdfPath);
try(OutputStream outputStream = new FileOutputStream(file)) {
// 转换 HTML to PDF
Pd