UweGabbert wrote:
I use a 64-bit System with 8 or 16 GB RAM. The result PDF is most < 2MB.
If your code runs in a 32-bit process it cannot access more than 2 GiB of RAM. Try running in a 64-bit process to give it more RAM.
But it is still unusual to break the 2 GiB limit with just a few pages and just a few images.
Saving the MigraDoc document before rendering will probably not have a significant effect on the RAM usage. The PDF file is the result of rendering anyway.
Which version of PDFsharp/MigraDoc are you using?
viewtopic.php?f=2&t=832