CPDF -
-
- Member
- Posts: 85
- Joined: Thu Jun 23, 2011 11:41 am
CPDF -
Can anyone help with one issue I have with CPDF….
I have a variable in my XML called “Imprint” – which reflects where the imprint of the book is. I’m trying to use CPDF to extract just this imprint with:
“%1” [Metadata.Integer:Path=”/jobInfo/Imprint”,Dataset=”Xml”,Model=”XML”] –o “%2”
I’m extracting the info, but I think I must have the wrong syntax – as I’m getting no output – can you see where I am going wrong – or how I might get an exit/error code to tell me why I have no file…?
Thanks!
I have a variable in my XML called “Imprint” – which reflects where the imprint of the book is. I’m trying to use CPDF to extract just this imprint with:
“%1” [Metadata.Integer:Path=”/jobInfo/Imprint”,Dataset=”Xml”,Model=”XML”] –o “%2”
I’m extracting the info, but I think I must have the wrong syntax – as I’m getting no output – can you see where I am going wrong – or how I might get an exit/error code to tell me why I have no file…?
Thanks!
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
CPDF -
Clive, here's how I call an external application.
var String args = new Array();
var appPath = s.getSpecialFolderPath("PluginResources") + "/" + "ftpdel.pl"
args[0] = appPath;
args[1] = theServer;
args[2] = thePath;
args[3] = job.getName();
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus != 0) {
job.log(cLogError, "FTPdel: delete failed");
}
var String args = new Array();
var appPath = s.getSpecialFolderPath("PluginResources") + "/" + "ftpdel.pl"
args[0] = appPath;
args[1] = theServer;
args[2] = thePath;
args[3] = job.getName();
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus != 0) {
job.log(cLogError, "FTPdel: delete failed");
}
-
- Member
- Posts: 85
- Joined: Thu Jun 23, 2011 11:41 am
CPDF -
dkelly wrote: Clive, here's how I call an external application.
var String args = new Array();
var appPath = s.getSpecialFolderPath("PluginResources") + "/" + "ftpdel.pl"
args[0] = appPath;
args[1] = theServer;
args[2] = thePath;
args[3] = job.getName();
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus != 0) {
job.log(cLogError, "FTPdel: delete failed");
}
Thanks Dwight - but here's where I show my ignorance - how do i get that code in, with the CPDF variables...?
var String args = new Array();
var appPath = s.getSpecialFolderPath("PluginResources") + "/" + "ftpdel.pl"
args[0] = appPath;
args[1] = theServer;
args[2] = thePath;
args[3] = job.getName();
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus != 0) {
job.log(cLogError, "FTPdel: delete failed");
}
Thanks Dwight - but here's where I show my ignorance - how do i get that code in, with the CPDF variables...?
-
- Newbie
- Posts: 1
- Joined: Sun Nov 27, 2011 5:20 pm
CPDF -
Hi Clive, I'm not sure what you are trying to do with the "imprint" information but below is an example of the syntax I use in switch with CPDF to add a blank page and insert some variables into the blank page. Hope it helps.
-pad-after "%1" AND -add-text "[Stats.PageWidth] n[Stats.PageHeight] n[Stats.Colorants] n[Stats.ColorMode] n[Stats.Fonts] n[Switch.OutgoingName] n[Stats.ColorSpaceFamilies]" -range 2 -o "%2"
-pad-after "%1" AND -add-text "[Stats.PageWidth] n[Stats.PageHeight] n[Stats.Colorants] n[Stats.ColorMode] n[Stats.Fonts] n[Switch.OutgoingName] n[Stats.ColorSpaceFamilies]" -range 2 -o "%2"
-
- Member
- Posts: 85
- Joined: Thu Jun 23, 2011 11:41 am
CPDF -
Hmm, this is "doing my head in" - I can launch CPDF from a command prompt - and all is fine. Using some sample flows I had from Bert - all is fine. I can write text onto a PDF by CPDF - all is fine...
...but when I try the code at the start of the thread - even substituting manual variables, all I get is:
File '_311Q9_Bronner.pdf' was sent to null; it will be deleted when the entry point finishes
It's driving me up the wall - grrr
*angry face
...but when I try the code at the start of the thread - even substituting manual variables, all I get is:
File '_311Q9_Bronner.pdf' was sent to null; it will be deleted when the entry point finishes
It's driving me up the wall - grrr
*angry face
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
CPDF -
var value = job.getVariableAsString("Metadata.Integer:Path=”/jobInfo/Imprint”,Dataset=”Xml”,Model=”XML”");
var String args = new Array();
args[0] = "/opt/local/bin/CPDF";
args[1] = inputPath;
args[2] = value;
args[3] = outputPath;
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus != 0) {
job.log(cLogError, "CPDF failed: " + myProc.exitStatus);
}
-
- Member
- Posts: 85
- Joined: Thu Jun 23, 2011 11:41 am
CPDF -
dkelly wrote:
var value = job.getVariableAsString("Metadata.Integer:Path=”/jobInfo/Imprint”,Dataset=”Xml”,Model=”XML”");
var String args = new Array();
args[0] = "/opt/local/bin/CPDF";
args[1] = inputPath;
args[2] = value;
args[3] = outputPath;
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus != 0) {
job.log(cLogError, "CPDF failed: " + myProc.exitStatus);
}
You're going to get very fed up with me Dwight - I am still failing to see how i write this into a script element. I launch the scripter, and paste it between:
// Is invoked each time a new job arrives in one of the input folders for the flow element.
// The newly arrived job is passed as the second parameter.
function jobArrived( s : Switch, job : Job )
{
and
}
giving:
// Is invoked each time a new job arrives in one of the input folders for the flow element.
// The newly arrived job is passed as the second parameter.
function jobArrived( s : Switch, job : Job )
{
var String args = new Array();
args[0] = "/opt/local/bin/CPDF";
args[1] = inputPath;
args[2] = value;
args[3] = outputPath;
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus != 0) {
job.log(cLogError, "CPDF failed: " + myProc.exitStatus);
}
}
...but I can't save this as a script...
I know I am missing something really basic here - but alas, I'm no programmer - I could get by in Basic, and understand most of the principles - once I can get my head round my problem I'm sure I'll fall into a scripting frenzy...
var value = job.getVariableAsString("Metadata.Integer:Path=”/jobInfo/Imprint”,Dataset=”Xml”,Model=”XML”");
var String args = new Array();
args[0] = "/opt/local/bin/CPDF";
args[1] = inputPath;
args[2] = value;
args[3] = outputPath;
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus != 0) {
job.log(cLogError, "CPDF failed: " + myProc.exitStatus);
}
You're going to get very fed up with me Dwight - I am still failing to see how i write this into a script element. I launch the scripter, and paste it between:
// Is invoked each time a new job arrives in one of the input folders for the flow element.
// The newly arrived job is passed as the second parameter.
function jobArrived( s : Switch, job : Job )
{
and
}
giving:
// Is invoked each time a new job arrives in one of the input folders for the flow element.
// The newly arrived job is passed as the second parameter.
function jobArrived( s : Switch, job : Job )
{
var String args = new Array();
args[0] = "/opt/local/bin/CPDF";
args[1] = inputPath;
args[2] = value;
args[3] = outputPath;
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus != 0) {
job.log(cLogError, "CPDF failed: " + myProc.exitStatus);
}
}
...but I can't save this as a script...
I know I am missing something really basic here - but alas, I'm no programmer - I could get by in Basic, and understand most of the principles - once I can get my head round my problem I'm sure I'll fall into a scripting frenzy...
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
CPDF -
function jobArrived( s : Switch, job : Job )
{
var outputPath = job.createPathWithName(job.getName(), false);
var value = job.getVariableAsString("[Metadata.Integer:Path='/jobInfo/Imprint',Dataset='Xml',Model='XML']");
var String args = new Array();
args[0] = "/opt/local/bin/CPDF";
args[1] = job.getPath();
args[2] = value;
args[3] = outputPath;
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus == 0) {
job.sendToSingle(outputPath);
return;
}
job.fail("CPDF failed!");
}
-
- Member
- Posts: 85
- Joined: Thu Jun 23, 2011 11:41 am
CPDF -
Thanks Dwight,
I just had to change the path (as CPDF is running on a PC Switch), and add the "-o" output as another argument - and it's working, yay, happy days etc...
function jobArrived( s : Switch, job : Job )
{
var outputPath = job.createPathWithName(job.getName(), false);
var value = job.getVariableAsString("[Metadata.Integer:Path='/jobInfo/Imprint',Dataset='Xml',Model='XML']");
var ouput = "-o"
var String args = new Array();
args[0] = "cpdf.exe";
args[1] = job.getPath();
args[2] = value;
args[3] = ouput;
args[4] = outputPath;
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus == 0) {
job.sendToSingle(outputPath);
return;
}
job.fail("CPDF failed Clivey!");
}
}
Thanks for all your help my friend!
I just had to change the path (as CPDF is running on a PC Switch), and add the "-o" output as another argument - and it's working, yay, happy days etc...
function jobArrived( s : Switch, job : Job )
{
var outputPath = job.createPathWithName(job.getName(), false);
var value = job.getVariableAsString("[Metadata.Integer:Path='/jobInfo/Imprint',Dataset='Xml',Model='XML']");
var ouput = "-o"
var String args = new Array();
args[0] = "cpdf.exe";
args[1] = job.getPath();
args[2] = value;
args[3] = ouput;
args[4] = outputPath;
var myProc = new Process(args);
myProc.start();
myProc.waitForFinished(60);
if (myProc.exitStatus == 0) {
job.sendToSingle(outputPath);
return;
}
job.fail("CPDF failed Clivey!");
}
}
Thanks for all your help my friend!
-
- Member
- Posts: 85
- Joined: Thu Jun 23, 2011 11:41 am
CPDF -
dkelly wrote: you don't need to define a variable for the "-o" argument, just use
args[3] = "-o";
Yes - I see that now, I'd put it in, but without the quotes, and when it didn't work thought I had to use it as a variable like the rest....
args[3] = "-o";
Yes - I see that now, I'd put it in, but without the quotes, and when it didn't work thought I had to use it as a variable like the rest....