Hi,
We are facing memory issues while converting PDF to PDF/A. For example, I tried converting "Aspose_EndUserAgreement.pdf" from PDF to PDF/A, which is 197KB but when it converted to PDF/A, the size became 1.92MB.
I am really surprised by looking at the size of PDF/A. Can you please let me know why it is creating such a big file? How to bring it back to the size of original PDF or near to original size.
I used "com.aspose.pdf.Document.OptimizationOptions" but it helped to reduce file size by 25% only i.e. 2MB file came down to 1.5 MB. But still its a big file for original file size of 200KB.
Nayyer is able to reproduce the issue and here is issue tracking id PDFNEWNET-34925
Any quick help is appreciated.
// Open document com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("input.pdf");
// Convert to PDF/A compliant document pdfDocument.validate("Validation_log.xml", com.aspose.pdf.PdfFormat.PDF_A_1B);
pdfDocument.convert("Conversion_log.xml", com.aspose.pdf.PdfFormat.PDF_A_1B, com.aspose.pdf.ConvertErrorAction.Delete);
// Save updated document pdfDocument.save("output.pdf");
// Open document com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("input.pdf");
// Convert to PDF/A compliant document pdfDocument.validate("Validation_log.xml", com.aspose.pdf.PdfFormat.PDF_A_1B);
pdfDocument.convert("Conversion_log.xml", com.aspose.pdf.PdfFormat.PDF_A_1B, com.aspose.pdf.ConvertErrorAction.Delete);
// Save updated document pdfDocument.save("output.pdf");
// Load source PDF file com.aspose.pdf.Document doc = new Document("source.pdf");
// Optimize the file size by removing unused objects com.aspose.pdf.Document.OptimizationOptions opt = new Document.OptimizationOptions();
opt.setRemoveUnusedObjects(true);
opt.setRemoveUnusedStreams(true);
opt.setLinkDuplcateStreams(true);
doc.optimizeResources(opt);
// Save the updated file doc.save("optimized.pdf");
Thanks