2. Code Snippet:
- Code: Select all
public static String convertDocToPdf(MultipartFile file) throws IOException {
// Set license key
// com.spire.license.LicenseProvider.setLicenseKey(LICENSE_KEY);
com.spire.license.LicenseProvider.setLicenseKey(LICENSE_KEY);
File tempDocFile = File.createTempFile("tempDoc", "." + "doc");
try (FileOutputStream outputStream = new FileOutputStream(tempDocFile)) {
IOUtils.copy(file.getInputStream(), outputStream);
}
File tempFile = File.createTempFile(file.getName(), "." + "pdf");
Document document = new Document();
document.loadFromFile(tempDocFile.getAbsolutePath(), FileFormat.Doc);
ToPdfParameterList ppl = new ToPdfParameterList();
ppl.isEmbeddedAllFonts(true);
ppl.setDisableLink(true);
document.setJPEGQuality(40);
document.saveToFile(tempFile.getAbsolutePath(), ppl);
return addPageNumberToPDF(tempFile.getAbsolutePath());
}
3. Spire Office version:
Manifest-Version: 1.0
Extension-Name: spire.office
Implementation-Title: spire.office for java
Implementation-Version: 8.12.0
Implementation-Vendor: E-iceblue Co., Ltd.
Implementation-Vendor-Id: com.spire
Implementation-URL: https://www.e-iceblue.com
4. Application Type: Spingboot JDK 1.8