license
<License>
<Data>
<Products>
<Product>Aspose.Total for Java</Product>
</Products>
<EditionType>Enterprise</EditionType>
<SubscriptionExpiry>29991231</SubscriptionExpiry>
<LicenseExpiry>29991231</LicenseExpiry>
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
</Data>
<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>
</License>
1.word转html
InputStream license = Class.class.getClassLoader().getResourceAsStream("license文件路径");
com.aspose.words.License loadLic = new com.aspose.words.License();
loadLic.setLicense(license);
com.aspose.words.Document wb = new com.aspose.words.Document("word文件");
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.setExportImagesAsBase64(true);
saveOptions.setExportTextInputFormFieldAsText(false);
wb.save(out, saveOptions);
2.excel转html
InputStream license = Class.class.getClassLoader().getResourceAsStream("license文件路径");
com.aspose.cells.License loadLic = new com.aspose.cells.License();
loadLic.setLicense(license);
Workbook excel = new Workbook("excel文件");
excel.save(out, com.aspose.cells.SaveFormat.HTML);
3.ppt转html
InputStream license = Class.class.getClassLoader().getResourceAsStream("license路径");
com.aspose.slides.License loadLic = new com.aspose.slides.License();
loadLic.setLicense(license);
Presentation ppt = new Presentation("文件");
ppt.save(out, com.aspose.slides.SaveFormat.Pdf);
4.word转pdf
InputStream license = Class.class.getClassLoader().getResourceAsStream("license路径");
com.aspose.words.License license1 = new com.aspose.words.License();
license1.setLicense(license);
OutputStream fileOutputStream1 = new FileOutputStream("pdf文件路径");
com.aspose.words.Document wb = new com.aspose.words.Document("word文件路径");
wb.save(fileOutputStream1, SaveFormat.PDF);
5.excel转pdf
public static ByteArrayOutputStream excel2Pdf(InputStream fileStream) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream license = Class.class.getClassLoader().getResourceAsStream("license路径");
com.aspose.cells.License loadLic = new com.aspose.cells.License();
loadLic.setLicense(license);
IndividualFontConfigs configs = new IndividualFontConfigs();
//加载字体文件
configs.setFontFolder("字体文件夹路径", true);
LoadOptions loadOptions = new LoadOptions();
loadOptions.setFontConfigs(configs);
Workbook excel = new Workbook(fileStream, loadOptions);
// 设置pdf保存的格式以及强制所有列都在同一页
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(true);
excel.save(out, pdfSaveOptions);
return out;
}