import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import com.aspose.words.Document;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import com.sunxung.factoring.component.exception.BusinessException;
import com.sunxung.factoring.component.util.CodeUtil;
public class AsopUtil {
public static File doc2pdf(String inPath, String outPath) {
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
// return;
throw new BusinessException(CodeUtil.FAIL, "验证License失败");
}
File file = null;
//outPath = "testFile/test.pdf";
//inPath="testFile/test.docx";
try {
long old = System.currentTimeMillis();
file = new File(outPath); // 新建一个空白pdf文档
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
FileOut
word转pdf
最新推荐文章于 2024-11-07 14:35:25 发布
分享个人经验,成功将word.docx转换为pdf,页眉在转换后仍能显示。对比使用openoffice转换,因版本兼容问题,页眉无法在pdf中呈现。

最低0.47元/天 解锁文章
1063

被折叠的 条评论
为什么被折叠?



