使用jacob转换pdf,word和excel都可以,就是ppt不能转换,不知道是什么原因。
代码如下:
ActiveXComponent app = new ActiveXComponent("PowerPoint.Application");
Dispatch ppts = app.getProperty("Presentations").toDispatch();
Dispatch ppt = Dispatch.call(ppts,
"Open",
inputFile,
true,//ReadOnly
true,//Untitled指定文件是否有标题
false//WithWindow指定文件是否可见
).toDispatch();
Dispatch.call(ppt,
"SaveAs",
pdfFile,
ppSaveAsPDF
); //ppSaveAsPDF=32
Dispatch.call(ppt, "Close");
app.invoke("Quit");