|
|
|
@ -129,6 +129,10 @@ public final class PDFConvertUtil {
|
|
|
|
* @param outputStream pdf文件输出流
|
|
|
|
* @param outputStream pdf文件输出流
|
|
|
|
**/
|
|
|
|
**/
|
|
|
|
public static boolean wordToPdfByAspose(InputStream inputStream, OutputStream outputStream) {
|
|
|
|
public static boolean wordToPdfByAspose(InputStream inputStream, OutputStream outputStream) {
|
|
|
|
|
|
|
|
return convertWordToPdfByAspose(inputStream, outputStream);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static boolean convertWordToPdfByAspose(InputStream inputStream, OutputStream outputStream) {
|
|
|
|
|
|
|
|
|
|
|
|
// 验证License 若不验证则转化出的pdf文档会有水印产生
|
|
|
|
// 验证License 若不验证则转化出的pdf文档会有水印产生
|
|
|
|
if (!getLicense()) {
|
|
|
|
if (!getLicense()) {
|
|
|
|
@ -140,6 +144,9 @@ public final class PDFConvertUtil {
|
|
|
|
// 将源文件保存在com.aspose.words.Document中,具体的转换格式依靠里面的save方法
|
|
|
|
// 将源文件保存在com.aspose.words.Document中,具体的转换格式依靠里面的save方法
|
|
|
|
com.aspose.words.Document doc = new com.aspose.words.Document(inputStream);
|
|
|
|
com.aspose.words.Document doc = new com.aspose.words.Document(inputStream);
|
|
|
|
doc.setFontSettings(fontSettings);
|
|
|
|
doc.setFontSettings(fontSettings);
|
|
|
|
|
|
|
|
// Blob URL 预览时浏览器会读取 PDF 的文档标题。清除 Word 原始标题,
|
|
|
|
|
|
|
|
// 避免某些文档的二进制标题被显示成 yAAAA... 之类的乱码。
|
|
|
|
|
|
|
|
doc.getBuiltInDocumentProperties().setTitle("reference-answer");
|
|
|
|
|
|
|
|
|
|
|
|
// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,EPUB, XPS, SWF 相互转换
|
|
|
|
// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,EPUB, XPS, SWF 相互转换
|
|
|
|
doc.save(outputStream, SaveFormat.PDF);
|
|
|
|
doc.save(outputStream, SaveFormat.PDF);
|
|
|
|
|