Problem splitting HUGE pdf. 600mb 12k+ Pages

Hi to all.

I’m having a problem.

I’m trying to split a HUGE pdf into several small ones.


Take a look at the code:

PdfFileEditor pdfEditor = new PdfFileEditor();
MemoryStream[] pages = pdfEditor.SplitToPages(url);
List tempPaths = new List();
int page = 0;
foreach(MemoryStream stream in pages)
{
String path = Path.Combine(Path.GetTempPath(), page + “.pdf”);
tempPaths.Add(path);
FileStream fs = File.OpenWrite(path);
stream.Position = 0;
fs.Write(stream.GetBuffer(), 0, (int)stream.Position);
fs.Close();
page++;
}

At the 2nd line, I’ve been getting a Out of Memory Exception.

How to solve?

Hi David,

In SplitToPages method you have provided URL, I just wanted to confirm whether you’re accessing this file from a remote location? If so, please try to access it from the local disk. Also, please share how much memory is available to process these files?

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

I am accessing from local disk. But could also be remotely (Didnt’t test for it yet).
I’m working on a computer with 4gb Ram.

Hi David,

Can you please upload the problematic PDF file somewhere so we could download and test the issue with that file? I’m afraid, in order to understand and resolve the issue, we need to reproduce it at our end, so the sample file would be helpful.

We’re sorry for the inconvenience and appreciate your cooperation.
Regards,