Hello Aspose Team,
I’m reaching out regarding a significant discrepancy we’ve noticed in the PDF file sizes generated using Aspose.PDF.
Issue Summary
Despite generating identical content, PDFs created by our existing library are consistently smaller, while Aspose-generated PDFs tend to be larger in file size.
For example:
A very long document (~3,600 pages): Aspose → ~7.6 MB (compared to smaller expected size)
A mid-size document (~500 pages): Aspose → ~1.1 MB
Importantly, these documents do not contain large or high-resolution images, so image-heavy content is not the cause of the large file size.
Objective
We would like to reduce the file size of PDFs generated by Aspose.PDF without compromising document fidelity.
Could you please advise on:
-
Available optimization features (e.g., OptimizeResources, ImageCompressionOptions)?
-
Recommended parameter settings (image compression, font embedding, removal of unused objects)?
-
C# examples or best practices we can implement to minimize output size?
-
Any other tools or techniques (such as linearization or resource linking) to help reduce size?
We already attempted to optimize using this C# snippet:
var optimizationOptions = new OptimizationOptions
{
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
LinkDuplicateStreams = true,
ImageCompressionOptions =
{
CompressImages = true,
ImageQuality = 0,
MaxResolution = 100
}
};
pdfDocument.OptimizeResources(optimizationOptions);
pdfDocument.Optimize();
pdfDocument.RemoveMetadata();
pdfDocument.OptimizeResources(optimizationOptions);
pdfDocument.Optimize();
pdfDocument.RemoveMetadata();
Thank you for your guidance and support.