PDF Compression does not work (increased file size) plus PDF is damaged

Hi Aspose team,

when I use new settings:

document.OptimizeResources(new Document.OptimizationOptions()
{
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
CompressImages = true,
RemovePrivateInfo = true,
ImageQuality = 50,
MaxResoultion = 75
});


My originally 128622 bytes document is growing on 140746 plus it is broken.
If CompressImages = true or RemoveUnusedStreams = true file will be damaged.

Sample project is attached.

Btw. If I use www.ilovepdf.com to compress the same file (I am selecting their recommended settings) file size is reduced to 62kb (file: Helia 44-ilovepdf-compressed (1).pdf is attached). If I choose extreme compression they are reducing size to 48Kb (attached file: Helia 44-ilovepdf-compressed (2).pdf).

From forum I saw that you had more than few people having PDF compression issue so would be great to make some breakthrough here :)

Btw. Big compression I saw when I set UnembedFonts=true but this will ruin document formatting as some default font is used.

Also when I compare with documents compressed by ilovepdf.com I see that in original document I had 6 embedded fonts (1x ArialMT, 3x Helvetica, 2x Helvetica-Bold). Can you extend Aspose.PDF to remove duplicated fonts but also unsed fonts? That will certainly help in this case.


Thanks,
Oliver

Hi Oliver,


Thanks for contacting support and sharing details.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial; -webkit-text-stroke: #000000} span.s1 {font-kerning: none}

I have tested the scenario and have managed to reproduce the problem that after applying optimization code the size of your provided PDF document increases. For the sake of correction, I have logged it as PDFNET-42382 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time.


We are sorry for this inconvenience.


Best Regards,