I have to merge multiple 1 page pdf\'s into one pdf. I\'m using iTextSHarp 5.5.5.0 to accomplish this, but when I get to merge more than 900-1000 pdf I get an out of memory
Since this is a large amount of stuff I'd recommend writing directly to a FileStream
instead of a MemoryStream
. This might be an actual case where an Out of Memory Exception might literally mean "Out of Memory".
Also, as Bruno pointed out, the "smart" part of PdfSmartCopy
unfortunately comes at the cost of memory, too. Switching to PdfCopy
should reduce memory pressure although your final PDF might be larger.