OL Learn

How to merge PDF files after split by Page count?


So I’ve managed to split one large PDF file by page count, but now I need to merge back the files that have the same page count. That is, all the 2 -page PDFs into one, 3-page PDFs into one, etc.

Actually, What I’d rather be able to do is to cut out the two steps and split that one large PDF with records that are mixed in 2-pages, 3-pages, 4-pages, 5-pages, etc. into multiple files where all the 2-pages are in one PDF file, all the 3-pages are in one PDF file, etc. I know it’s possible, I just don’t know how to do it. I’ve tried everything.

Please note: My workflow begins with a PDF that is already created. Client sends the PDF with different records + different page counts all mixed in.

How do I do that, please?

Thank you!


Since you already have a PDF, you could bring the pdf in as the data and use the Metadata Plugins.

  1. Create Metadata (Pass Through is fine)
  2. Metadata Level Creation (Set the Document Level where records start or finish)
  3. Metadata Fields Management (Add a PageCount field and populate it with the document page count.)
  4. Metadata Sorter (Sort on PageCount field)
  5. Metadata Level Creation (Set the Group Level where PageCount field changes)
  6. Metadata Sequencer (Accept the default of Group and enter 1 as the number of occurences)
  7. Create PDF
  8. Output to Folder (I would use the PageCount meta location and _%u.pdf as the file name.)

Thank you.

I am a little confused at the Metadata Fields Management stage. I added a PageCount field, but I’m not sure how to populate it with the document page count.

Thank you,

You right click and you will have a Get Metadata Location as a choice. You will want to pick the document level and you will see options for you to select. “Pages in Document”

It should give you a sting like this:

GetMeta(SelectedPageCount[0], 11, Job.Group[0].Document[0])

I have not played with it for a while, but I’m pretty sure you will have to change the document array from 0 to ? for it to work the way you need it to.

GetMeta(SelectedPageCount[0], 11, Job.Group[0].Document[?])

You will have to step a sample pdf in debug, before you see your choices. (You will be able to see your choices once it passes the create metadata plugin, but it will be only one document at that level.

You could click on view metadata as you step it through to get yourself familiar with what each of the plugins are doing to the metadata.


Thank you! I managed to make this work.

I was wondering whether there was a way to add sequence number, based on record count and add it to the PDFs once they have been sorted, and separated by page count?

Thank you for your help.

The string I gave you on the last answer could work as your sequence number after you sort everything.

GetMeta(SelectedPageCount[0], 11, Job.Group[0].Document[0])

It is zero based, so if you want it to be one, you will need to do that with the math plugin or a script. (Just add 1 and set a new variable with the answer.)


Hi Saturn,

I mean to add a sequence number (for example, next to the name, address block) on the PDF, like a bates numbering system on Adobe Acrobat.

So for each record, page 1, there would be a sequence number added, ex. 000001, then record 2, page 1, would be 000002.

Is this possible to do if you start with a PDF file? (no designer file.)