use of com.aspose.words.SaveOptions in project iaf by ibissource.
the class WordConvertor method convert.
@Override
public void convert(MediaType mediaType, Message message, CisConversionResult result, String charset) throws Exception {
if (!MEDIA_TYPE_LOAD_FORMAT_MAPPING.containsKey(mediaType)) {
throw new IllegalArgumentException("Unsupported mediaType " + mediaType + " should never happen here!");
}
try (InputStream inputStream = message.asInputStream(charset)) {
Document doc = new Document(inputStream, MEDIA_TYPE_LOAD_FORMAT_MAPPING.get(mediaType));
new Fontsetter(cisConversionService.getFontsDirectory()).setFontSettings(doc);
SaveOptions saveOptions = SaveOptions.createSaveOptions(SaveFormat.PDF);
saveOptions.setMemoryOptimization(true);
long startTime = new Date().getTime();
doc.save(result.getPdfResultFile().getAbsolutePath(), saveOptions);
long endTime = new Date().getTime();
LOGGER.debug("Conversion(save operation in convert method) takes ::: " + (endTime - startTime) + " ms");
result.setNumberOfPages(getNumberOfPages(result.getPdfResultFile()));
}
}
Aggregations