Hello,
we recieve a PDF File with 6 Pages, than I split the PDF
and get 6 PDFs,
_1
_2
_3
_4
_5
_6
PDF _3 and PDF _6 will be removed because the Page size is different.
Than I want that PDF _1 and _2 will be merged together and _4 and _5 will be merged together,
because these PDFs belong together.
The number of pages can differ, it wont be always 6 pages, it can be 3 that we recieve just 3 Pages or 9 pages,
but the scheme will be always the same. (Page 3...6...9 have to be removed).
Is there a way to merge the correct pages together?
I tryed to merge every 2 pages but it doesn't always merge the correct pages together.
Another point is the File naming, I would like to number the Files aswell .... PDF _1+_2 merged should numbered _1....
PDF _3+_4 should numbered with _2 ... and so on.
Is there a way to do this?
Thank you very much for your help.
Split PDF & Merge again
-
- Newbie
- Posts: 19
- Joined: Mon Jun 01, 2015 8:05 am
- Location: Switzerland
Re: Split PDF & Merge again
There is always a way with Switch, although the only thing I could think of was, afterwards, more difficult as I thought it would be.

Split PDF creates files this way, I use the variables [Job.NameProper:Before="_"] and [Job.NameProper:After="_"] multiple times in the flow.
jobName_1.pdf
jobName_2.pdf
jobName_3.pdf
Let me try to explain some things with coloring.
1. Green arrow, 3rd pages. This includes all jobs that's a multiple of 3, based on the jobname after Split PDF.
Pages: 3, 6, 9.
2. Yellow arrow, 2nd pages. This includes all jobs that is a multiple of 3 minus 1.
Pages: 2, 5, 8
The folder location of 2nd pages folder is static, not auto managed due to the Inject Job later.
3. Green folder, 1st pages.
Pages: 1, 4, 7
We create a unique Job State, so we can use this as a identifier to Assemble job later.
I choose Switch Date to be the identifier, with seconds and milliseconds included it's quite unique.
Job State: [Switch.Date:TimeZone="UTC"]
All 1st pages are pushed to the gray arrow and the blue one.
4. Blue arrow.
Blue arrow injects the 2nd page of every 1st page, by simply injecting based on the value in the filename, and add + 1 by that.
You might need a Hold Job for a couple of seconds before this inject, to be sure your 2nd page arrived in the inject location.
[Job.NameProper:Before="_"]_[Switch.Calculation:Expression="[Job.NameProper:After="_"]+1"]
5. Assemble job
Wait for every two files with [Job.JobState] as identifier, we did set this at point 3. Green folder.
I'll think of something about the file naming, but this should get your started
I hope my explanation is a little clear!
Flow download: http://we.tl/v6yBwfkiow

Split PDF creates files this way, I use the variables [Job.NameProper:Before="_"] and [Job.NameProper:After="_"] multiple times in the flow.
jobName_1.pdf
jobName_2.pdf
jobName_3.pdf
Let me try to explain some things with coloring.
1. Green arrow, 3rd pages. This includes all jobs that's a multiple of 3, based on the jobname after Split PDF.
Pages: 3, 6, 9.
Code: Select all
var pageNumber = job.getVariableAsNumber("[Job.NameProper:After=\"_\"]");
var include;
if (pageNumber % 3 == 0) {
// Multiple of 3, so include
include = true;
} else {
include = false;
}
include;
Pages: 2, 5, 8
The folder location of 2nd pages folder is static, not auto managed due to the Inject Job later.
Code: Select all
var pageNumber = job.getVariableAsNumber("[Job.NameProper:After=\"_\"]");
var include;
if ((pageNumber + 1) % 3 == 0) {
// 2nd pages
include = true;
} else {
include = false;
}
include;
Pages: 1, 4, 7
We create a unique Job State, so we can use this as a identifier to Assemble job later.
I choose Switch Date to be the identifier, with seconds and milliseconds included it's quite unique.
Job State: [Switch.Date:TimeZone="UTC"]
All 1st pages are pushed to the gray arrow and the blue one.
4. Blue arrow.
Blue arrow injects the 2nd page of every 1st page, by simply injecting based on the value in the filename, and add + 1 by that.
You might need a Hold Job for a couple of seconds before this inject, to be sure your 2nd page arrived in the inject location.
[Job.NameProper:Before="_"]_[Switch.Calculation:Expression="[Job.NameProper:After="_"]+1"]
5. Assemble job
Wait for every two files with [Job.JobState] as identifier, we did set this at point 3. Green folder.
I'll think of something about the file naming, but this should get your started

Flow download: http://we.tl/v6yBwfkiow
Last edited by sander on Tue Dec 22, 2015 1:11 pm, edited 1 time in total.
Part of my playground:
- HP Indigo 10k, HP Indigo 7600's (full options), Highcon Euclid III, Zünd S3
- HP Production Pro 6.0.1, HP Production Center 2.5.1 beta, Apogee 9.1, Enfocus Switch 13u1 & PitStop Server 13u2.
Chat: open-automation @ gitter
- HP Indigo 10k, HP Indigo 7600's (full options), Highcon Euclid III, Zünd S3
- HP Production Pro 6.0.1, HP Production Center 2.5.1 beta, Apogee 9.1, Enfocus Switch 13u1 & PitStop Server 13u2.
Chat: open-automation @ gitter
-
- Newbie
- Posts: 19
- Joined: Mon Jun 01, 2015 8:05 am
- Location: Switzerland
Re: Split PDF & Merge again
Hello Sander,
thank you very much, that's awesome
, I haven't expected such a detailed reply.
I downloaded the attached Flow yesterday, but unfortunatly I'm currently busy with other jobs and cannot
try it out or follow your explanations yet.
I will come back to this post as soon as possible.
thank you very much, that's awesome

I downloaded the attached Flow yesterday, but unfortunatly I'm currently busy with other jobs and cannot
try it out or follow your explanations yet.
I will come back to this post as soon as possible.