pdftk and cat command
pdftk and cat command
I'm using pdftk elsewhere within my flows so I know it works but I'm trying to build a cat command.
The requirement is to have an input file (A.pdf) that is 100 pages long that uses the cat command to insert (B.pdf which is a single page) after every page in A.pdf before saving it out.
Is this possible? Does anybody have an example string of the cat command working?
Thanks for any help
Andrew
The requirement is to have an input file (A.pdf) that is 100 pages long that uses the cat command to insert (B.pdf which is a single page) after every page in A.pdf before saving it out.
Is this possible? Does anybody have an example string of the cat command working?
Thanks for any help
Andrew
Re: pdftk and cat command
The app Duplicate pages PRO can do that for you.
Re: pdftk and cat command
Getting an error "application not available on Switch Server"
Re: pdftk and cat command
It is using PDFToolkit to do the job so you have to have that installed. In some cases you have to tell Switch where the Pdftk files are.
Read the manual, it will tell you how to do it.
Read the manual, it will tell you how to do it.
Re: pdftk and cat command
I already have PDFtk installed and running successfully within other flows so I know it works OK.
Any other ideas?
Any other ideas?
Re: pdftk and cat command
In the app you can right click in the app section to the right on your screen and there select "Set path to application..." Doing so you will tell the app where it can find the pdftk.exe. And it must be pdftk server that you have on your system.
Re: pdftk and cat command
On Windows the App expect the pdftk server to be in this path: \Program Files (x86)\PDFtk Server\bin\pdftk.exe
If it is not you have to tell Switch and the App where to find it with the "Set path to application..." that you find by right clicking the app icon in the app list.
If it is not you have to tell Switch and the App where to find it with the "Set path to application..." that you find by right clicking the app icon in the app list.
Re: pdftk and cat command
Trying the cat command with something like this but it fails.
A=100page PDF
B=1page PDF
Output file should have B inserted into A after EVERY page.
A="%1" B="C:\Users\switch\Desktop\Blank.pdf" cat A1-end B1 output "%2"
Any ideas why it won't work?
TIA
A=100page PDF
B=1page PDF
Output file should have B inserted into A after EVERY page.
A="%1" B="C:\Users\switch\Desktop\Blank.pdf" cat A1-end B1 output "%2"
Any ideas why it won't work?
TIA
Re: pdftk and cat command
For this particular scenario we're using Quite HotFolders where it's a proverbial doddle to achieve that. You can tell it to insert a blank page at whatever intervals you want, whatever size of a blank you want, how many blanks you need etc plus so much more... Worth considering, we've been using it for years and never failed to deliver
Re: pdftk and cat command
I think it's doing exactly what you are telling it to do, your resulting PDF is probably 101 pages pdf.abonsey wrote:Trying the cat command with something like this but it fails.
A=100page PDF
B=1page PDF
Output file should have B inserted into A after EVERY page.
A="%1" B="C:\Users\switch\Desktop\Blank.pdf" cat A1-end B1 output "%2"
Any ideas why it won't work?
TIA
Using your method, you would have to change B to 100 pages too, to get your desired result.
Knowing this you can either split your pdf and try to merge it with injected page, or pre-create B with different page counts and pick one to merge at appropriate time, or use some app, like Jan's suggestion, or Arthur's suggestion...
I am sure there are other methods, but this should be enough for you to figure it out.
-
- Newbie
- Posts: 6
- Joined: Thu Aug 16, 2012 11:49 am
Re: pdftk and cat command
Hi Peeps,
I too face this similar issue, but with the [shuffle] command. Running the command at command prompt does work.
Below is the setting i use, the job end up in problem folder due to exit code = 1 :
Name Execute command
Description
Execution mode Concurrent
Command or path C:/Program Files (x86)/PDFtk Server/bin/pdftk.exe
Arguments A="C:\Switch-Template\playingCardFront_v01.pdf" B="%1" shuffle A B output "%2"
Output File at path
Copy input job Yes
Output extension Automatic
Fail if exit code is Nonzero
Fail if stdout contains
Fail if stderr contains
Thanks in advance!
I too face this similar issue, but with the [shuffle] command. Running the command at command prompt does work.
Below is the setting i use, the job end up in problem folder due to exit code = 1 :
Name Execute command
Description
Execution mode Concurrent
Command or path C:/Program Files (x86)/PDFtk Server/bin/pdftk.exe
Arguments A="C:\Switch-Template\playingCardFront_v01.pdf" B="%1" shuffle A B output "%2"
Output File at path
Copy input job Yes
Output extension Automatic
Fail if exit code is Nonzero
Fail if stdout contains
Fail if stderr contains
Thanks in advance!
Re: pdftk and cat command
Please use the app Execute Command Friend and make a command file to use instead. In your case a Bat-file.
It will make it work for you.
It will make it work for you.
-
- Newbie
- Posts: 6
- Joined: Thu Aug 16, 2012 11:49 am
Re: pdftk and cat command
Bummer! I'm stuck with switch v12, so no Appstore for me.
I've try to create a script package to execute the command but end up with exit code ="-1"
Still pondering what did wrong.
*playingCardFront_v01.pdf is store at the same location as PDFtk.exe
I've try to create a script package to execute the command but end up with exit code ="-1"
Still pondering what did wrong.
*playingCardFront_v01.pdf is store at the same location as PDFtk.exe
Code: Select all
function jobArrived( s : Switch, job : Job )
{
//pdftk A=fronts.pdf B=back_x1500.pdf shuffle A B output print_job.pdf
var jobFolder = job.createPathWithName(job.getNameProper(), true);
var pdfFilename = jobFolder + "/" + job.getNameProper() + ".pdf";
s.log(1, pdfFilename);
var appPath = "C:\\Program Files (x86)\\PDFtk Server\\bin\\pdftk";
var fronts = "playingCardFront_v01.pdf";
var backs = job.getName();
command = appPath+" "+"A="+fronts+" "+"B="+backs+" shuffle A B "+" output "+pdfFilename;
var exitCode = Process.execute(command);
s.log(1, command);
s.log(1, exitCode);
}
Re: pdftk and cat command
Version 12 est ex Medio Aevo, sic ego respondebit in latinum. Variabilis "backs" est solum nomen (job.getName()), sed debet esse completum viam (job.getPath()). Non oblivisci notas!!
Code: Select all
"B='"+backs+"' shuffle ...
Re: pdftk and cat command
Here is an BAT-file example on how to run pdftk from the Execute Command.
Play around with it. The B-file has to be in a specific folder in this case and you have to setup the Switch flow to put that copy in a folder and rename it before it ends up in that folder.
Play around with it. The B-file has to be in a specific folder in this case and you have to setup the Switch flow to put that copy in a folder and rename it before it ends up in that folder.
Code: Select all
set inputfile=%1
set outfile=%2
pdftk.exe A=%inputfile% B="C:\for_switch\insert_first_page\background.pdf" cat B1 A1-end output %outfile%