We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PdfFileEditor.SplitToPages Out of Memory exception

I was using v6.7 of PdfFileEditor.SplitToPages to split a multi-page PDF into individual page files and I ran into a Out of Memory exception when the file size was >64k. I upgraded to the latest version, v9.7, and that fixed that problem but introduced another. The resulting PDFs get loaded into an EMC ApplicationXtender instance which worked fine with the output of the v6.7 pages but fails with the output of the v9.7 pages.

Can I find out which was the first version of Aspose.Pdf after v6.7 that fixed the memory issue? Or, what the difference is in the output of the v9.7 PDF page that is causing ApplicationXtender to fail?

Sample code:
List pageFileList = new List();
int pageNumber = 0;
string baseFileName = Path.GetFileNameWithoutExtension(inputFile);
string pageFileName = String.Empty;
pdfFileEditor = new PdfFileEditor();
inputStream = new FileStream(inputFile, FileMode.Open);
outputBuffer = pdfFileEditor.SplitToPages(inputStream);
foreach (MemoryStream ms in outputBuffer)
{
pageNumber++;
pageFileName = Path.Combine(outputDirectory, String.Format("{0}_Page{1}.PDF", baseFileName, pageNumber));

                outputStream = new FileStream(pageFileName, FileMode.Create);
                ms.WriteTo(outputStream);
                outputStream.Close();
                outputStream = null;

                pageFileList.Add(pageFileName);

                // attempts to make v9.7 page work
                // with ApplicationXtender

                //pdfDocument = new Aspose.Pdf.Document(pageFileName);
                //pdfValidateLog = Path.ChangeExtension(pageFileName, "log");
                //pdfDocument.Validate(pdfValidateLog, PdfFormat.v_1_6);
                //pdfDocument.Save(pageFileName);
                //pdfDocument.Dispose();
                //try { File.Delete(pdfValidateLog); }
                //catch { }
Hi Mike,


mlugo@penntreaty.com:
I was using v6.7 of PdfFileEditor.SplitToPages to split a multi-page PDF into individual page files and I ran into a Out of Memory exception when the file size was >64k. I upgraded to the latest version, v9.7, and that fixed that problem but introduced another. The resulting PDFs get loaded into an EMC ApplicationXtender instance which worked fine with the output of the v6.7 pages but fails with the output of the v9.7 pages.

Can I find out which was the first version of Aspose.Pdf after v6.7 that fixed the memory issue? Or, what the difference is in the output of the v9.7 PDF page that is causing ApplicationXtender to fail?



Thanks for your inquiry. I am afraid we cannot confirm you about the old version in which your issue can be fixed. We maintain a single code base of Aspose Components, so all the fixes and new features/enhancements are implemented in latest version of DLL.

As you mentioned you have managed to resolve the Out of Memory exception with latest version of Aspose.Pdf for .NET i.e. 9.7.0, so issue relates to EMC instead Aspose. Initially, please check which PDF version EMC ApplicationXtender accepts and you can change PDF file version accordingly using following code. If issue exists then you may contact EMC ApplicationXtender support for the issue resolution.


Document doc = new Document(pdf);<o:p></o:p>

doc.Convert(myDir + “log.xml”, PdfFormat.v_1_7, ConvertErrorAction.Delete);<o:p></o:p>

FileStream fs = new FileStream(myDir + “PDF_1.7.pdf”, FileMode.Create, FileAccess.Write);<o:p></o:p>

doc.Save(fs);<o:p></o:p>

fs.Close();


Please feel free to contact us for any further assistance.


Best Regards,