Merge PDFs and rename based on pdf filenames

Post Reply
JBrs
Newbie
Posts: 12
Joined: Wed Mar 23, 2016 6:55 pm

Merge PDFs and rename based on pdf filenames

Post by JBrs »

Hi,

I have a switch flow that will merge 2 pdfs (front and back--page1 and page2) into 1 pdf and rename resulting pdf to match folder name. Before dropping into input folder I have to place both pdfs into a folder and name the folder like the pdfs (minus a few prefix characters and the _p1 designation). How can I bypass those first 2 steps? I want to be able to drop both pdfs directly into Switch. Or I want to NOT worry about naming the folder and leave it as "untitled", put both pdfs into it and then drop the folder into the workflow, but have Switch name resulting PDF using part of the existing original PDF name and not the folder name--which would be "untitled". Example of files: "00000_PM177778_XYZ-P0036_p1.pdf" and "00000_PM177778_XYZ-P0036_p2.pdf". I want to merge and name resulting PDF as "177778_XYZ-P0036.pdf". I don't have much experience in Switch and I'm just stumbling through the basic workflows now. Any help will be appreciated.
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Merge PDFs and rename based on pdf filenames

Post by gabrielp »

Lots of ways to do this, here's what comes to my mind if you cannot control the naming or structure of the input files:

So, when splitting files out of folders, there's like 3 ways of doing it in Switch. The one you'd need is Ungroup, which will make it easy to assemble the separate PDFs again once you split them. You also need to know how to parse the data you want out of your filenames. You'd want something like a write to private data script (if you have Scripter) or MetaTagger (if you don't have Scripter). It would be helpful to write the original filename, the job number, and the page number of each PDF to private data before processing. You can then use the values for routing and renaming. You might be able to get by using Job State, to save these values if you don't want to use Private Data.

So you Ungroup, then route the files to Renames which name them 1.pdf and 2.pdf or something, then Assemble them back into a job folder, using the Ungroup private data key, then Merge PDF, then into a final Rename.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
JBrs
Newbie
Posts: 12
Joined: Wed Mar 23, 2016 6:55 pm

Re: Merge PDFs and rename based on pdf filenames

Post by JBrs »

gabrielp---thank you for the input. Unfortunately, this is all over my head. I'm going to explore those suggestions and learn more about how these elements work. I thank you for taking the time to post these suggestions. You have given me a specific direction to learn about.
Post Reply