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
PdfWriter writer = new PdfWriter(outputStream);
PdfDocument pdfDocument = new PdfDocument(writer);
// 设置PDF大小
pdfDocument.setDefaultPageSize(PageS