Topic Options
#56212 - 08/08/18 04:03 PM Merge PDFs in Numerical Order
Karlie Offline
OL Toddler

Registered: 09/05/11
Posts: 33
Loc: New Zealand
Hi there,

What is the best way to merge a large number (up to 4000) of single page PDFs in numerical order based on their name. For example:

Name 1.pdf
Name 2.pdf
Name 3.Pdf
Name 4.pdf
....
....

and so.

I tried using the Merge PDF plugin with the alphabetical sorting but this doesn't seem to work. It seems to be a little random.

What's the best way to achieve this?

Thanks in advance, cheers!

Top
#56213 - 08/08/18 04:33 PM Re: Merge PDFs in Numerical Order [Re: Karlie]
Yannick Fortin Offline
OL Expert

Registered: 08/25/00
Posts: 349
Loc: Objectif Lune Montréal
My psychic debugging powers tell me that by "random", you mean "the plugin uses a strict alphabetical order". So "Name 60.pdf" comes after "Name 400.pdf" because the first character that differ is 4 vs 6. Which is obviously not what you want.

One solution would be to pad the numbers with zeroes. This way, "Name 0060.pdf" comes before "Name 0400.pdf", as it should be.

The other solution would be to write a script that implements a sorting algorithm that sorts the way you want and then use the AlambicEdit scripting API to merge the PDF files.
_________________________
Yannick Fortin, Team OL

Top
#56229 - 08/15/18 04:07 PM Re: Merge PDFs in Numerical Order [Re: Yannick Fortin]
Karlie Offline
OL Toddler

Registered: 09/05/11
Posts: 33
Loc: New Zealand
Thank Yannick!

That was exactly it. I have added leading zeros and now it works smile

Cheers

Top