Topic Options
#56772 - 02/19/19 12:04 PM PDF Merging with Custom Sort
Anwar Hussain Offline
OL Toddler

Registered: 12/02/17
Posts: 37
Loc: OH
Hi ObjectIf Lune Team,

I am using the "Concatenate PDF Files" Action in PlanetPress Workflow to merge PDFs. Is there a way to merge the PDFs with respect to files names with sorting ? For example, If we have the following PDFs in a folder,
1. INVOICE.pdf
2. CREDIT.pdf
3. DEBIT.pdf
4. MRA.pdf
5. RPL.pdf

Can sort them and merge or merge while sorting so that the final PDF sequence pages is MRA-INVOICE-RPL-DEBIT-CREDIT ? Also, if this possible with a external config or XREF file ? Meaning, the workflow should read the config file and sort-merge as per the custom sort order ?


Thanks

Anwar Hussain


Edited by Anwar Hussain (02/19/19 01:10 PM)

Top
#56778 - 02/19/19 03:57 PM Re: PDF Merging with Custom Sort [Re: Anwar Hussain]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 324
Loc: Home
If I understood you correctly, I would set a condition to process each file accordingly ( MRA-INVOICE-RPL-DEBIT-CREDIT )and once you created all your PDF's then use merged PDF to merge them using Time interval. This way you will end up with one merged PDF file starting with MRA and ending with CREDIT.
I hope this was helpful.
_________________________
Peace

Top
#56781 - 02/20/19 11:15 AM Re: PDF Merging with Custom Sort [Re: Anwar Hussain]
Anwar Hussain Offline
OL Toddler

Registered: 12/02/17
Posts: 37
Loc: OH
Hi Sami,

Thanks for the immediate response. My bad, i missed one point. There will multiple PDF files with the same prefix and these files can get created at different timings from source as shown below. Now, while merging to single PDF, i want to make sure, all same files (With same prefix) are in order, i mean all MRA should come first, then INVOICE and so on (as MRA-INVOICE-RPL-DEBIT-CREDIT).

1. INVOICE_001.pdf
2. CREDIT_002.pdf
3. DEBIT_001.pdf
4. MRA_003.pdf
5. RPL_004.pdf
6. INVOICE_002.pdf
7. CREDIT_003.pdf
8. MRA_004.pdf

The final single PDF can have any name.

Thanks

Anwar Hussain


Edited by Anwar Hussain (02/20/19 11:27 AM)

Top
#56782 - 02/20/19 11:40 AM Re: PDF Merging with Custom Sort [Re: Anwar Hussain]
Jean-Cédric Online   content
OL Expert

Registered: 10/03/16
Posts: 479
Loc: Québec, Canada
  1. What you should do is a process that is trigger by a dummy text file (Folder Capture input) or a scheduler that runs at a specific time using a Create file input (your choice).
  2. Use the Folder Listing plugin to get an XML file list of all files found in the folder.
  3. Use the Open XSLT plugin to re-arrange the XML file according to your need. Of course, you need to understand XSLT in order to do so. You could as well do it in a script using the Run Script plugin.
  4. Use XML splitter plugin to split your XML file into multiple XML files. One for each file found in the folder.
  5. Use the Folder Capture plugin as an action to load each file, 1 at the time, using a mask (which is the exact name of the current file, as defined in the XML file).
  6. Then output to a folder while having the Concatenate files check box checked. Make sure to set a fixe name for the output file or it won't concatenate.

Top