Hi Aspose team,
using following code I tried to compress one PDF document:
Console.WriteLine(DateTime.Now.ToString());
// The path to the documents directory.
string dataDir = Path.GetFullPath("doc.pdf");
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(dataDir);
pdfDocument.OptimizeSize = true;
pdfDocument.Optimize();
pdfDocument.OptimizeResources(new Aspose.Pdf.Document.OptimizationOptions()
{
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
CompressImages = true,
AllowReusePageContent=true,
ImageQuality = 40
});
pdfDocument.Save("output.pdf");
Console.WriteLine(DateTime.Now.ToString());
// The path to the documents directory.
string dataDir = Path.GetFullPath("doc.pdf");
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(dataDir);
pdfDocument.OptimizeSize = true;
pdfDocument.Optimize();
pdfDocument.OptimizeResources(new Aspose.Pdf.Document.OptimizationOptions()
{
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
CompressImages = true,
AllowReusePageContent=true,
ImageQuality = 40
});
pdfDocument.Save("output.pdf");
Console.WriteLine(DateTime.Now.ToString());
Output.pdf is with almost no content.
Can you please have a look? Test project is attached.
Btw. output document size was 118Kb where by using www.smallpdf.com and www.ilovepdf.com size was around 60kb.
I know that I am boring with compression topics (already have few tickets) but it will be excellent if you work a little bit on algorithm.
Thanks,
Oliver