admin管理员组文章数量:1638919
pom文件代码
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>21.11.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/aspose.pdf.jar</systemPath>
</dependency>
java相关代码
public static void pdfToWord(String pdfFilePath, String wordFilePath) {
try {
long old = System.currentTimeMillis();
getLicensePPT();
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(pdfFilePath);
pdfDocument.save(wordFilePath, com.aspose.pdf.SaveFormat.Doc);
long now = System.currentTimeMillis();
System.out.println("Pdf 转 Word 共耗时:" + ((now - old) / 1000.0) + "秒");
System.out.println("PDF转换为Word成功!");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
String pdfFilePath = "F:\\资料\\1.pdf";
String wordFilePath = "F:\\资料\\Desktop\\22.docx";
pdfToWord(pdfFilePath, wordFilePath);
}
//去水印
public static boolean getLicensePPT() {
boolean result = false;
InputStream is = null;
try {
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
org.springframework.core.io.Resource[] resources = resolver.getResources("classpath:license2.xml");
is = resources[0].getInputStream();
com.aspose.pdf.License aposeLic = new com.aspose.pdf.License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return result;
}
如果需要相关jar包文件,可以评论后发,比较着急或不了解的可以加vx好友探讨
版权声明:本文标题:aspose转换,pdf转word 无水印无页数限制 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1729280772a1194006.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论