功能需求要求实现文档上传、下载、查看、删除,查看没弄过,别的就不提了,以下是我记录的实现文档在线查看的方法以及效果图
实现思路
首先把word文件转为pdf,然后在用js查看pdf文件实现在线查看功能。
主要用到的知识点:
1.word转pdf:
导入包 com.aspose.words.Document;
使用其中的
//pathFile是doc路径
Document document = new Document(pathFile.toString());
//pathDirs+File.separator+wordDate+"_"+netWork+".pdf"是pdf路径
File outputFile = new File(pathDirs+File.separator+wordDate+"_"+netWork+".pdf");
//操作文档保存
document.save(outputFile.getAbsolutePath(), com.as