Open hucheng91 opened 7 years ago
jdk 1.8,xdocreport 1.0.5;
i was want to make docx to pdf in chinese the pdf can create but the font unreadable; if the docx is English not the problem
java code
public static void makePdfByXcode(){ long startTime=System.currentTimeMillis(); try { XWPFDocument document=new XWPFDocument(new FileInputStream(new File("D:/cache/qqChace/T1/ceshi.docx"))); File outFile=new File("D:/cache/qqChace/T1/ceshiEnglish.pdf"); outFile.getParentFile().mkdirs(); OutputStream out=new FileOutputStream(outFile); PdfOptions options= PdfOptions.create().fontEncoding("utf-8"); PdfConverter.getInstance().convert(document,out,options); } catch ( Throwable e) { e.printStackTrace(); } System.out.println("Generate ooxml.pdf with " + (System.currentTimeMillis() - startTime) + " ms."); } my docx [docx](http://ojefm7q7h.bkt.clouddn.com/test.docx) create pdf [pdf](http://ojefm7q7h.bkt.clouddn.com/test.pdf)
同问
jdk 1.8,xdocreport 1.0.5;
i was want to make docx to pdf in chinese the pdf can create but the font unreadable; if the docx is English not the problem
java code