Extracted Pages Dramatically Increase in Size

I’m using Aspose.PDF .NET version 6.7.0.0. As part of our process, we extract certain pages from a source PDF and insert them into a destination PDF. For certain PDF’s, when the pages are extracted, they are quite large which causes the resulting new PDF to be larger than the original document even though it has the same or fewer pages.


Below is a simplified version of the code I’m using to do the extraction:
protected void Page_Load(object sender, EventArgs e)
{
Aspose.Pdf.Document inputDoc = new Aspose.Pdf.Document(@"\Client Reassessment and Supervisory Visit Record.pdf");

foreach (Aspose.Pdf.Page pge in inputDoc.Pages)
{
using (MemoryStream imageStream = new MemoryStream())
{
Aspose.Pdf.Document newDoc = new Aspose.Pdf.Document();
newDoc.Pages.Add(pge);

//convert page to byte array
using (MemoryStream pageStream = new MemoryStream())
{
newDoc.Save(pageStream);
}
}
}
}

The original document (attached) is 324KB. When you get the first page out, the memory stream is ~280KB, the second is another 275KB. So, if all you do is pull the pages out and put them back into a new file, the resulting file expands by over 200KB.

I'm wondering if there's a way to compress the resulting file, compress the pages as they go in or if it's something to do with my source document.

Thanks.
Lance Safford

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

Thank you for sharing the sample code and template file.

We have already registered the issue in our issue tracking system with issue id: PDFNEWNET-33435. You will be notified via this forum thread once the issue get resolved.

Sorry for the inconvenience,

Is there any update on this?


Thanks.

Lance Safford

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

Our development team is working on your issue and the issue is a bit complex. The fix is scheduled to be a part of our monthly release of Aspose.Pdf for .NET v7.0 (to be released in early May 2012). Please be patient and spare us sometime to rectify the issue. We will update you via this forum thread regarding any updates.

Sorry for the inconvenience,

The issues you have found earlier (filed as PDFNEWNET-33435) have been fixed in Aspose.Pdf for .NET 7.0.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)