Hi Aspose team,
in case of some PDF documents that I wanted to compress Aspose components are increasing size of “compressed” document and also in some cases destroying images.
Over attached project you can make test.
Attached documents:
- doc.pdf, size 1678518 bytes
- doc_compressed.pdf, size 3416593 (image in header of this document is destroyed)
- paypal_subscription.pdf, size 552973
- paypal_subscription_compressed.pdf, size: 965317
When I tried to compress same files over smallpdf.com I got following results:
- paypal_subscription.pdf was reduced to 279.9KB
- doc.pdf was reduced to 1.39Mb
Can you assist?
P.S. Documents are in bin/debug folder.
Thanks,
Oliver
Hi Oliver,
Document pdfDocument = new Aspose.Pdf.Document(myDir
- “paypal_subscription.pdf”);<o:p></o:p>
pdfDocument.OptimizeResources(new Document.OptimizationOptions()
{
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
CompressImages = true,
ImageQuality = 50,
UnembedFonts = false,
AllowReusePageContent = true
});
pdfDocument.Save(myDir + "paypal_subscription_compressed.pdf");
Thanks for reply, worked for images
Second question is what are plans to improve compressions?
If you check paypal_subscription document Aspose managed to compress it to 504kb and one of free online tools reduced document size mich better.
Quality of both documents is similar (good).
Thanks,
Oliver
Hi Oliver,
Hi Oliver,
Aspose.Pdf.Document
document = new Aspose.Pdf.Document(“38850.pdf”);<o:p></o:p>
// Optimzie the file size by removing
unused objects<o:p></o:p>
document.OptimizeResources(new
Aspose.Pdf.Document.OptimizationOptions()<o:p></o:p>
{<o:p></o:p>
LinkDuplcateStreams = true,<o:p></o:p>
RemoveUnusedObjects
= true,<o:p></o:p>
RemoveUnusedStreams = true,<o:p></o:p>
AllowReusePageContent = true,<o:p></o:p>
UnembedFonts = true,<o:p></o:p>
CompressImages = true,<o:p></o:p>
ResizeImages = true,<o:p></o:p>
MaxResoultion = 150,<o:p></o:p>
ImageQuality = 10<o:p></o:p>
});<o:p></o:p>
// Save the updated file<o:p></o:p>
document.Save(“38850-out.pdf”);<o:p></o:p>
Best Regards,
The issues you have found earlier (filed as PDFNEWNET-38850) have been fixed in Aspose.Pdf for .NET 16.12.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
(1)