编程语言
首页 > 编程语言> > 【Java】使用Aspose实现office转换为pdf

【Java】使用Aspose实现office转换为pdf

作者:互联网

public class XXXConverter {

    public XXXConverter() throws Exception {
        License license = new License();
        InputStream open = XXXConverter.class.getResource("license.xml").openStream();
        license.setLicense(open);
        open.close();
    }

    public void getWordsConverter(String oldPath, String newPath) throws Exception {
        Document doc = new Document(new FileInputStream(oldPath));
        doc.save(newPath, SaveFormat.PDF);
    }

    public void getSlidesConverter(String path, String newPath) throws Exception {
        Presentation pres = new Presentation(new FileInputStream(path));
        pres.save(newPath, SaveFormat.Pdf);
    }

    public void getExcelConverter(String path, String newPath) throws Exception {
        Workbook book = new Workbook(new FileInputStream(path));
        book.save(newPath, SaveFormat.PDF);
    }
}

 

标签:newPath,Exception,Java,String,office,new,Aspose,path,public
来源: https://blog.csdn.net/T_amo/article/details/89493532