Shrinking file size of PDF file through Aspose.Pdf.Kit

I see several posts about shrinking or Optimizing PDF file sizes. Most of them say that the functionality is being worked on. Unfortunately none have been updated recently. Is this still planned to be implemented? If so, can you get an ETA? I need to shrink large PDFs for a project I am working on. For example there is an 8332 KB PDF that can be shrunk in two ways in Adobe. By using the Reduce File Size function it is reduced to 5048 KB. By printing to Adobe PDF with the setting of Fit to printable area it is reduced to 2548 KB. As you can see this functionality will be incredibly helpful when users need to get to the files from spotty connections.

Thanks,

Hi,

We have provided support for optimizing PDF files in the new merged Aspose.Pdf for .NET. This component provides features of both Aspose.Pdf and Aspose.Pdf.Kit. Please note that the versions 6.0.0 and above are part of the merged Aspose.Pdf for .NET; any release with version lower than 6.0.0 is part of the legacy version and will be discontinued from October 2011. You can find the example of optimizing the PDF on the following page:Optimize PDF for the Web.

I hope this helps. If you find any further questions, please do let us know.
Regards,

Thanks for the info, I will try this out with the newest version.

Thanks,

I have tested this out and it doesn't appear to make a difference (In some cases it made the file bigger). On the files that I tried this on I got the following results.

With a 164KB file, the optimized file was 166KB

With a 184KB file, the optimized file was 183KB

With a 282KB file, the optimized file was 280KB

With a 8332KB file, the optimized file was 8335KB

Here is the code I used with the latest version of Aspose.Pdf

Dim oPdf As New Aspose.Pdf.Document(sInputFile)

oPdf.Optimize()

oPdf.Save(sOutputFile)

Hi,

Thanks for using our products.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>

I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-30310. We will investigate this
issue in details and will keep you updated on the status of a correction.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””><span style=“font-size:10.0pt;
font-family:“Arial”,“sans-serif””>

We apologize for your inconvenience.


Is there an ETA for a fix on this?

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Well, I have received the following feedback from the development team and according to them this is not an issue in Aspose.Pdf for .NET.

Method Optimize () just make Pdf document linearized. The primary goal for a linearized PDF file is to achieve the following behavior:
1. when a document is opened, display the first page as quickly as possible. The first page to be viewed may be an arbitrary page of the document, not necessarily page 0 (though opening page 0 is most common).
2. When the user requests another page of an open document (for example, by going to the next page or by following a link to an arbitrary page), display that page as quickly as possible.
3. When data for a page is delivered over a slow channel, display the page incrementally as it arrives. To the extent possible, display the most useful data first.
4. Permit user interaction, such as following a link, to be performed even before the entire page has been received and displayed.


So, it is not necessary that Optimized Pdf document will be smaller. Moreover, we often see that Adobe Acrobat save arbitrary Pdf document as linearized document with greater length. So issue description is totally normal.

Please feel free to share your comments / observations with us.

Sorry for the inconvenience,