生成pdf:
public String savePdf(WordprocessingMLPackage wordMLPackage,Map data) throws Exception {
String pdfDir = getFilePath() + ".pdf";
File file = new File(pdfDir);
FileUtils.createDir(file);
//使用默认的FOSettings settings.setWmlPackage(wmlPackage);settings.setApacheFopMime("application/pdf");
OutputStream os = new java.io.FileOutputStream(file);
Docx4J.toPDF(wordMLPackage, os);
os.flush();
os.close();
if (logger.isDebugEnabled()) {
logger.debug("savepath:"+file.getAbsolutePath());
}
return pdfDir;
}
比如说,生成word的时候,可以指定word的上下左右页边距,但是生成pdf时,如何控制页边距,我却没有找到,隐约觉得FOSettings类里会支持,但始终没有找到。
同理,做word转pdf时,也是不知如何控制pdf的页边距。
word转pdf:
public String doc2pdf(String docxPath,