一个JavaEE服务,将Office文档转换为PDF,格式兼容性好。
- 安装微软Office 2010或以上版本
- 解压release/xoffice.zip,运行startup.bat
http://locahost:9090/xoffice?_xformat=*文档格式*&_file=*文档地址*&_watermark=*水印*
文档格式:doc、docx、xls、xlsx、ppt、pptx
文档地址:http协议地址,需要用UTF-8编码
水印:pdf水印文本
public static void main(String[] args) {
XOfficeClient xc = new XOfficeClient("http://localhost:9090");
try {
xc.setWatermark("https://view.xdocin.com");
xc.to(new File("c:/tmp.docx"), new File("c:/tmp.pdf"));
} catch (IOException e) {
e.printStackTrace();
}
}
MIT