System.OutOfMemoryException when optimizing PDF

Hi,


We are getting out of memory exception when we try to optimize large PDF documents (Above 200MB) using below code.

pdfDoc.Optimize();
pdfDoc.Save(filepath);

Below is the exception Trace:

{System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.
at System.Collections.Generic.Dictionary2.Resize(Int32 newSize, Boolean forceNewHashCodes)</font></div><div><font size="2"> at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)
at ‹.Ž.(Int32 , Int32 , Int32 )
at ‹.Ž.(Int32 , Int32 , Int32 )
at ‹.Ž.( , Int32 )
at ..a(•a , Boolean )
at ..Write(•a , Boolean )
at ..Save(•a , ‹a )
at ‚a.–.Save()
at ‚a.ŸŒ.Save(Stream )
at .›•.Save(Stream )
at Aspose.Pdf.Document.Save(Stream output)
at Aspose.Pdf.Document.Save(String outputFileName)
at Com.Stpl.ARV.Core.eCTD.ARCorePublisher.UpdatePDFandOptimize(String BasePath, String path, String leafID, Int32& FilesModifiedCount, Dictionary2& LockedFiles, Int32& FileAlreadyUpdated, List1& ProtectedFiles, String userID, List`1 OperationList, TblGenProceesTempData Process) in d:\Test\Test.cs:line 5134}


Please let me know.

Thanks

Hi Chenna,


Thanks for using our API’s.

Can you please share your input/resource PDF, so that we can test the scenario in our environment. As our forums only permit uploading file upto 25 MB, so for larger files, you may consider uploading them to some free FTP and share the link with us. We are sorry for this inconvenience.

Hi,

You can download the sample PDF using the link below:

http://pd1.acutatech.com/TestPDF/samples/Aspose.pdf

Thanks,

Hi Chenna,


Thanks for sharing the resource file.

We are downloading the resource file and will keep you posted with our findings.

Hi Chenna,


Thanks
for using our API’s.
<o:p></o:p>

I
have tested the scenario and I am able to notice the same problem. For the sake
of correction, I have logged this problem as PDFNEWNET-38895 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.

We are having the same issue when trying to convert larger HTML documents to PDF. Aspose.pdf appears to be unable to produce a PDF file larger than 400KB. I hope ASPOSE implements a fix for this soon! If not, we will have to switch products for our HTML-to-PDF conversion requirements. Other than this bug, the product (ASPOSE.pdf) works nicely for our needs.

Hi Dirk,


Thanks for your inquiry. Please note issue varies document to document, so we will appreciate it if you please share your sample document here. We will test it and will provide you our findings accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Hi Talil Ahmed,

Any update on this issue (Issue ID: PDFNEWNET-38895)?

We verified this issue in last release of Aspose.Pdf for .NET v10.6.0 (Released on 13-Jul-2015) and the issue is still exists. This issue is very critical for us now. When can I expect this issue will be resolved? Or Do I have any workaround for this issue?

I really appreciate your response on this issue.

Thanks

Chenna Basappa C

Hi Cheena,


Thanks for your inquiry. I am afraid your reported issue is still not resolved, it is pending for the investigation in the queue with other issues. We have recorded your concern and requested our team to complete the investigation and share an ETA at their earliest. We will keep you updated about the issue resolution progress within this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

Hi Talil Ahmad,

We did not see the Issue ID: PDFNEWNET-38895 resolved in "Aspose.Pdf for .NET 10.7.0". Can I know when this will be resolved? This is very critical for us now.

Thanks

Chenna Basappa Cv

Hi Chenna,


Thanks for your patience.

As shared earlier, the problem reported earlier is not yet resolved and its still pending for review. However your concerns have been shared with development team and we have inquired the possible ETA. As soon as we have some definite updates regarding its resolution, we will let you know.

Hi Chenna,


Thanks for your patience.

We have further investigated the issue PDFNEWNET-38895 reported earlier and it appears to be a known issue. Please note that Linearization process is made over entire document and requires operation with all document objects. This algorithm can not be applied to part of the document and thus it can not be split into “stages”. That’s why large documents will require large amount of memory to load all document’s objects.

Hi Support,

Any update on the issue PDFNEWNET-38895 (System.OutOfMemoryException when optimizing PDF).
Please do let me is this still known issue or do you have any plans to address this issue.

Thanks,
Chenna Basappa

@chennabasappa.c

We are afraid there is no significant update regarding PDFNET-38895, formerly PDFNEWNET-38895, and increasing the RAM is only possible solution to avoid OutOfMemoryException for now.