PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

Document Save Stream
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2739
Page 1 of 1

Author:  wlapenta [ Mon Feb 17, 2014 3:02 pm ]
Post subject:  Document Save Stream

Hello, i have a question:

i write one pdf with about 15.000 pages, but after about 10000 i receive a OutMemoryException.
Then i decide to write one pdf with a stream every pages :

_document.Save(stream, false);
using (FileStream file = new FileStream(Path.Combine(_tmp_path, "Prova.pdf"), FileMode.Append))
{
file.Write(stream.ToArray(),0, stream.ToArray().Length);
}

But if i open a pdf create, i view the last pages inserted, and not all; this because where i save the document the pdfsharp insert a EOF command.
Can i write a pdf correctly?

Thanks.

Author:  Thomas Hoevel [ Mon Feb 17, 2014 3:14 pm ]
Post subject:  Re: Document Save Stream

Hi!

You cannot create a huge PDF file by saving multiple small PDF files in one stream (not sure that's what you are trying).

Are you running a 64 bit application on a 64 bit operating system?
64 bit applications can use more memory than 32 bit applications.
So if you have a 64 bit operating system but use a 32 bit application, compile your application as 64 bit.

Something else you could try:
1. Create a new PDF document, add 1000 pages, save it, close it.
2. Open it, append up to 1000 new pages, save it, close it.
Repeat 2 until all pages have been added. AFAIK this will reduce the memory consumption.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/