Free Support Forum - aspose.com

Saving to PDF results in large file

Hello,

we convert MSG to PDF via MHTML. If I convert the msg in attached zip-file a get a >50MB Output. The MHTML has about 5MB.

Why does the PDF-file has such a size?

File: at-3.zip (4.9 MB)

Codepart:
MhtSaveOptions mhtmlSaveOptions = SaveOptions.getDefaultMhtml();
mhtmlSaveOptions.setMhtFormatOptions(0);
mapiMessage.save(baos, mhtmlSaveOptions);

bais = new ByteArrayInputStream(baos.toByteArray());

Document doc = new Document(bais, getDocLoadOptions());

Iterator<Section> sectionIt = doc.getSections().iterator();
while (sectionIt.hasNext()) {
Section sec = sectionIt.next();
PageSetup pageSetup = sec.getPageSetup();
pageSetup.setPaperSize(PaperSize.A4);
pageSetup.setTopMargin(ConvertUtil.millimeterToPoint(15));
pageSetup.setBottomMargin(ConvertUtil.millimeterToPoint(15));
pageSetup.setLeftMargin(ConvertUtil.millimeterToPoint(15));
pageSetup.setRightMargin(ConvertUtil.millimeterToPoint(15));
}

PdfSaveOptions options = new PdfSaveOptions();
options.setCompliance(PdfCompliance.PDF_A_1_A);
options.setOptimizeOutput(true);
doc.save(baos2, options);
return baos2.toByteArray();

Thanks in advance,

Josef

If I do not use PDF-Compliance A-1-A it is about 3 MB. Why is the PDF file with compliance A-1-A that large?

We need PDFs for long term preservation.

@dvtdaten,

Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-16968. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.