OL Learn

How-to import/export XMP data from / into PDF

Hi,

it is possible to manipulate XML metadata inside a PDF in DataMapper or Designer. ?

Herve

Not directly. But Workflow allows you to do that through scripting, using the AlambicEdit API.

The following code extracts XMP metadata from the PDF data file and stores it in local variable xmpData:

var myFile = Watch.GetPDFEditObject();
myFile.Open(Watch.GetJobFileName(),false);
var xmp = myFile.GetXMP();
myFile.Close();
Watch.SetVariable("xmpData",xmp);

This one sets the XMP metadata of the PDF data file to the contents of variable xmpData:

var myFile = Watch.GetPDFEditObject();
myFile.Open(Watch.GetJobFileName(),false);
myFile.SetXMP( Watch.GetVariable("xmpData") );
myFile.Save();
myFile.Close();