When i split PDFs i am finding that the file size is dramatically bigger. A 5Mb multipage PDF ends up as 30Mb worth of single page PDF’s. I’ve tried using .Optimize() and .OptimizeResources(); Here is a code snippet:
Hi there,
var newPdf = new Document();
var currentPage = pdf.Pages[page];
newPdf.Pages.Add(currentPage);
newPdf.OptimizeResources();
As i mentioned in my original question I have tried OptimizeResources() unfortunately it has no effect. If i output all the pages as single page PDF’s i end up with a folder 5-6x the size.
Hi Rupert,
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-35353. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>
We apologize for your inconvenience.
Hi Rupert,
Document pdf = new
Document(“c:/pdftest/00000076V00.pdf”);<o:p></o:p>
for (int counter = 1; counter <= pdf.Pages.Count; counter++)
{
Document newPdf = new Document();
Page currentPage = pdf.Pages[counter];
newPdf.Pages.Add(currentPage);
newPdf.OptimizeResources(/*new Document.OptimizationOptions() { RemoveUnusedStreams = true }*/);
newPdf.Save("c:/pdftest/00000076V00_35353-" + counter + ".pdf");
}
Furthermore, the OptimizeResources method is improved to support elimination of unused color spaces. This allows to achieve lowest file size in customer case. Also please note that we can't expect that after splitting file into pages, total size of "Single-page" documents will be lower then source document. In some cases, it can be greater than source PDF file.
For example, if document with 100 pages contains shared resource and it's size is 100K, and this resource is used on every page of the document, then after splitting, every "one-page" document will contain this resource separately and total size will at least on 99 * 100k = 9900k greater. (In fact it will be even more greater because every of separated documents has own PDF document structure which also takes some place in the file).
The issues you have found earlier (filed as PDFNEWNET-35353) have been fixed in Aspose.Pdf for .NET 8.2.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.