insert file's tittle as metada in pdf

Post Reply
mcolmenero
Newbie
Posts: 19
Joined: Tue Feb 14, 2012 12:18 pm

insert file's tittle as metada in pdf

Post by mcolmenero »

Hi,

I want to insert the file's title in the pdf file as metada, through javascript or script with acrobat professional.

Is this possible?

Thank for your help

Best regards
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

insert file's tittle as metada in pdf

Post by freddyp »

The easiest solution is to do that with a PitStop Server Action List. You need just one action: Change document info. In the options you set it to change the title and select %Current Document Name% from the list of variables. If you need more flexibility in building the string you can enable the use of variables for the text field and use the Smart Preflight functionality.



Freddy
mcolmenero
Newbie
Posts: 19
Joined: Tue Feb 14, 2012 12:18 pm

insert file's tittle as metada in pdf

Post by mcolmenero »

Hi Freddy,

Thanks for you help.



I try to put like you say me, but I can´t find the action "change document info"or similar. I try to put set personal info:yes, and then I put here the diferent variable (username, filename and useremail), but it doesn´t gone.



I have pitstop server 11 and Acrobat Professional 9.



I try to make a script (js) like this: script element.

this.info.author = "my name";

this.info.copyright = "Copyright xA9" + this.modDate.getFullYear() + " by "+ identity.corporation;

this.info.subject = "tests";


But when Acrobat professinal open, send me a internal error, and it doesn't gone neither.



Finally a I tried to make by console with ExifTool, and it gone, but I don´t know how to call a console command in switch and pass some variable. I don´t know to make this with javascript.



Best regards

Miguel Colmenero
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

insert file's tittle as metada in pdf

Post by freddyp »

Look again: it is in the section "Metadata". Or when you filter on "document" it is the third action.



Freddy
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

insert file's tittle as metada in pdf

Post by dkelly »

I created this configurator for a Switch user last year. It uses exiftool to set up to 4 metadata variables.



https://www.dropbox.com/s/vg92nplom7dd9 ... ol.sscript



To set the author from Submit Point metadata you could set one of the properties to:



Author=[Metadata.Text:Path="/field-list/field[1]/value",Dataset="Submit",Model="XML"]



Here's a list of metadata names for PDF format.

http://www.sno.phy.queensu.ca/~phil/exi ... s/PDF.html



Dwight Kelly

Apago, Inc.
mcolmenero
Newbie
Posts: 19
Joined: Tue Feb 14, 2012 12:18 pm

insert file's tittle as metada in pdf

Post by mcolmenero »

Hi Freddy and Kelly,

The first, thank for your help.



For Freddy, I attachment capture-screen of my PitSoptSever, because a I can´t find it, sorry.

Link where there is capture-screen



For Kelly,

Thanks for you script, I try to put gone, but I don´t know what put in filed1 to field 4. I try to put:

Field1: the path of where it is exiftool.exe

Field2 to fiel3, I put the name file, date and extension.

And switch answer:

Failed to run external process: C:/Documents and Settings/admin/Application Data/Enfocus/Switch Server/backing/New flow/automanaged/Folder 1/_00JYQ_00018-prueba00006.pdf -o C:/Documents and Settings/admin/Application Data/Enfocus/Switch Server/temp/41/ScriptElement/12/4/00018-prueba00006.pdf -F:Script Otz flujos newexiftool.exe -2013-12-17T09:44:52.890Z -pdf -True



What I need to put in this field?

Best regards

Miguel
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

insert file's tittle as metada in pdf

Post by dkelly »

You will need to install Exiftool first.



Here are the download links:

Windows: http://www.sno.phy.queensu.ca/~phil/exi ... l-9.44.zip

OS X: http://www.sno.phy.queensu.ca/~phil/exi ... l-9.44.dmg



The properties "field1" to "field4" are where you set the metadata values you want to insert into the file. I provided an example above.




mcolmenero
Newbie
Posts: 19
Joined: Tue Feb 14, 2012 12:18 pm

insert file's tittle as metada in pdf

Post by mcolmenero »

Hi Kelly,

I have installed, but only it is a execute files.

I put inside program files and this the log from switch:



exiftool failed!



Failed to run external process: C:/Documents and Settings/admin/Application Data/Enfocus/Switch Server/backing/New flow/automanaged/Folder 1/_00JYW_prueba00006.pdf -o C:/Documents and Settings/admin/Application Data/Enfocus/Switch Server/temp/41/ScriptElement/12/31/prueba00006.pdf -F:Script Otz flujos newexiftool.exe -PDF:Author:prueba00006.pdf -PDF:Title:33800 -C:/Documents and Settings/admin/Application Data/Enfocus/Switch Server/backing/New flow/automanaged/Folder 1/_00JYW_prueba00006.pdf



I don´t know what I do bad.



See you
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

insert file's tittle as metada in pdf

Post by dkelly »

You could simply copy Exiftool.exe to C:Windows or contact me for assistance
Evan
Member
Posts: 30
Joined: Mon Feb 28, 2011 6:44 pm

insert file's tittle as metada in pdf

Post by Evan »

You may try this in the command section of Acrobat Configurator. You have to use "$doc" instead of "this". This will put the document filename into the "Title" document info. You can create additional metadata just by changing "Title" by something else.



If you want just the filename without the unique ID prefix you have to put the job filename proper into the argument 1 of Acrobat configurator and use $arg1 instead.



Ex. $doc.info.MyCustomTitle = $arg1



Use $arg1, $arg2, $arg3, $arg4, $arg5 to pass variable to acrobat

$doc is your current PDF

$error will log error to switch



try{

$doc.info.Title = $doc.documentFileName

}

catch(theError)

{

$error = theError

}[/code]
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

insert file's tittle as metada in pdf

Post by freddyp »

This is a late (holidays) reply to comment 6 with the link to the screen captures: the screenshots show the list of available Action Lists in Switch. In comment 2 I was referring to the building of an Action List yourself in PitStop Pro.



It will require that you know how to work with Smart Preflight variables in PitStop and Switch. There is the documentation and you will find some videos on youtube: search for "pitstop smart preflight".



Freddy
mcolmenero
Newbie
Posts: 19
Joined: Tue Feb 14, 2012 12:18 pm

insert file's tittle as metada in pdf

Post by mcolmenero »

Hi,

Finally y resolve with exiftool, thanks all people, for help me.

I leave the script for somebody need it.

See you







function jobArrived( s : Switch, job : Job )

{



var args3 = job.createPathWithExtension(job.getExtension(), false);

var metadato1 = s.getPropertyValue("field1" );//take the filename

var metadato2 = s.getPropertyValue("field2" );//take user to send it

var metadato3 = s.getPropertyValue("field3" );//take the name of company

var String befehl = "C:/WINDOWS/exiftool.exe";// take the path where it is the program installed

var archivo=job.getPath();



metadato1="-title="+metadato1 + " -author="+metadato2 + " -subject="+metadato3;



befehl=befehl+ ' ' + metadato1 +' -overwrite_original "'+archivo+'"';



var exitStatus =Process.execute(befehl);



if ((exitStatus == 0) ||(exitStatus == 1)) {

job.sendToSingle(job.getPath());

return;

}

}
jonasy
Member
Posts: 30
Joined: Tue Feb 01, 2011 11:50 am

insert file's tittle as metada in pdf

Post by jonasy »

There is also a method to update existing xmp fields in Switch without external applications: you can do so using the XMP Inject tool.



If you setup the "Action" property of the tool to "Update XMP", then you can set different rules to update the xmp metadata. Changing the title field can be done like this:



XMP location path: dc:title

New value: The new title you wish to give to the PDF file (This can be a static text, single line text with variables or a script expression).

Value type: Localized text

Generic language: (leave empty)

Specific language: x-default
Post Reply