文件名称:word转PDF工具类.zip
文件大小:9.25MB
文件格式:ZIP
更新时间:2023-01-01 04:29:58
word pdf 转换
word转PDF工具类 package com.zht; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import com.aspose.words.Document; import com.aspose.words.SaveFormat; public class Word2PdfUtilt { public static void main(String[] args) { doc2pdf("F:\\1\\1032.docx","F:\\1\\1032.pdf"); } public static void doc2pdf(String inPath, String outPath) { FileOutputStream os =null; try { File file = new File(outPath); // 新建一个空白pdf文档 os = new FileOutputStream(file); Document doc = new Document(inPath); // Address是将要被转化的word文档 doc.save(os, SaveFormat.PDF); } catch (Exception e) { e.printStackTrace(); }finally{ if(os!=null){ try { os.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
【文件预览】:
aspose-words-16.4.0-jdk16.jar
Word2PdfUtilt.java