PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Merge into multiple output files
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4153
Page 1 of 1

Author:  BobInCT [ Tue Jul 07, 2020 3:31 pm ]
Post subject:  Merge into multiple output files

I have an application that requires merging hundreds of PDF letters together. PDFSharp, when working with up to around 1200 or so letters works quite nicely for this. The problem is when going somewhere above that number the program crashes, presumably with an out of memory or other similar error.

My question is whether there's a way to stop the process at a certain number of letters, close the existing output file, open a different one, and continue? I've tried doing this but so far, no joy. I can open a new output file but the second file always contains all of the letters as if from the beginning.

I suppose I could keep track of the files processed, delete them from the working folder and restart the entire process but that's a lot of extra work and risk I'd rather not get into if possible.

Has anyone done this before?

TIA...

Author:  TH-Soft [ Wed Jul 08, 2020 11:47 am ]
Post subject:  Re: Merge into multiple output files

BobInCT wrote:
My question is whether there's a way to stop the process at a certain number of letters, close the existing output file, open a different one, and continue?
Yes, that's the way to go.
It is known to work when implemented correctly. Make sure to dispose the PDF document objects you no longer need.

Compile a list of files to process and make sure you add every file on the list just once.

Author:  BobInCT [ Thu Jul 09, 2020 7:30 pm ]
Post subject:  Re: Merge into multiple output files

I was able to get this working but only by moving a specific quantity of files to a temp directory, merge them into a single PDF, clean up the temp directory, and then repeat the process with another set. In the end I had multiple merged PDF files which was my goal.

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