I was asked by a colleague to split a PDF document created by MS Word's mail merge tool.

I wrote this console app to extract each page of the PDF individually and save those pages using text from the page as the file name.

I used the PDFSharp library to read the original PDF.

One key take away is where to set the OpenMode flag such that pages can be extracted.

var doc = PdfReader.Open(combinedPDFPath, PdfDocumentOpenMode.Import);

You can see the code on my GitHub account. PDFSplitter

To do: If I revisit this project I would add the text filters as arguments and allow the user to specify how many pages should be in each split.

Comments