Copy link to clipboard
Copied
I work at a large commercial printing company. Things being set to overprint when they shouldn’t be is a huge recurring problem leading to many re-prints and a lot of loss financially.
Ideally, I would like to implement a script that can detect if an Illustrator document contains items that are set to overprint. I am curious if there is any way of achieving this without needing to loop through every single thing in the document. I don’t need to modify the overprint setting on anything. I simply would like to alert the user if the document has anything set to overprint. If anyone knows of any method of detecting this on the document level, I would be forever grateful. Or if there are any other methods of achieving this, I am all ears.
Thanks!
try this with an active document
// load the library
if (ExternalObject.AdobeXMPScript == undefined) {
ExternalObject.AdobeXMPScript = new
ExternalObject("lib:AdobeXMPScript");
}
var ns = "http://ns.adobe.com/xap/1.0/t/pg/";
var propertyname = "HasVisibleOverprint";
//Create an XMPMeta object from the active documents XMPString:
var myXmp = new XMPMeta(app.activeDocument.XMPString);
// retrieve property if it exists
var doesprop = myXmp.doesPropertyExist(ns, propertyname); // true
...
Copy link to clipboard
Copied
there's a way, it could be scripted but for now you can check manually
- go to File->File Info...
- click on the Raw Data Section on left of the XMP metadata window
- type "hasVisibleOverprint" in the search field to go to the field
- you should see True or False
Copy link to clipboard
Copied
Hey, this is immensely helpful. Thank You!
When I run the following script it spits out "Undefined". I would imagine it is because it can't find the property. I have the document saved as a PDF. I believe I am using the correct namespace URI. However, when I include the prefix with the property name (xmpTPg:HasVisibleOverprint) it indicates that there is a Schema namespace URI and prefix mismatch. Is there a different namespace URI that I should be using? Or am I just off base in thinking that we have access to this metadata using the AdobeXMPScript library?
if ( ExternalObject.AdobeXMPScript == undefined ) {
ExternalObject.AdobeXMPScript = new ExternalObject( "lib:AdobeXMPScript");
}
var currentDoc = app.activeDocument;
var fileName = currentDoc.fullName;
var fixName = fileName.fsName;
var docXMPFile = new XMPFile(fixName, 0, XMPConst.OPEN_FOR_READ);
var docXMPData = docXMPFile.getPacketInfo();
var docXMPMeta = new XMPMeta(docXMPData.packet);
var overPrint = docXMPMeta.getProperty(XMPConst.NS_PDF, "HasVisibleOverprint");
alert(String(overPrint));
Really appreciate the help!
Thanks!
Copy link to clipboard
Copied
try this with an active document
// load the library
if (ExternalObject.AdobeXMPScript == undefined) {
ExternalObject.AdobeXMPScript = new
ExternalObject("lib:AdobeXMPScript");
}
var ns = "http://ns.adobe.com/xap/1.0/t/pg/";
var propertyname = "HasVisibleOverprint";
//Create an XMPMeta object from the active documents XMPString:
var myXmp = new XMPMeta(app.activeDocument.XMPString);
// retrieve property if it exists
var doesprop = myXmp.doesPropertyExist(ns, propertyname); // true
if (doesprop) {
var prop = myXmp.getProperty(ns, fieldName);
alert("namespace: " + prop.namespace + "\n\nproperty name: " + propertyname + "\n\nvalue: " + prop);
}
else {
alert (propertyname + " was not found");
}
Copy link to clipboard
Copied
This works like a charm. Below is the Frankenstein of a script that I came up with. The script below essentially just prompts the user to select files to check. Will definitely be messing around with this to see what other useful data I can extract from the Metadata and make more human redable for the people on my team.
//Load the external library
if ( ExternalObject.AdobeXMPScript == undefined ) {
ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
}
//Namespace and property name
var nameSpace = "http://ns.adobe.com/xap/1.0/t/pg/";
var propName = "HasVisibleOverprint";
//Variable to store files and the generated alert string
var allFiles;
var alertString = "Selected File(s) Overprint Settings\n";
//Prompt the user to open files for checking
allFiles = File.openDialog("Please select files to check.", undefined, true);
//Loop through the files selected by the user and check for overprint in the metadata
for(var i = 0; i < allFiles.length; i++) {
//Get metadata for the current file
var currentXMP = new XMPFile(allFiles[i].fsName, 0, XMPConst.OPEN_FOR_READ);
var packetXMP = currentXMP.getPacketInfo();
var currentMeta = new XMPMeta(packetXMP.packet);
//Check if the property exists in the data
var propTest = currentMeta.doesPropertyExist(nameSpace, propName);
//Name of the current file
var activeName = allFiles[i].name;
//Append to the alert string based on the existense of the property
if(propTest) {
//Get the property value
var activeProperty = currentMeta.getProperty(nameSpace, propName);
//Add to the alert string
alertString = alertString + activeName + "\nVisible Overprint: " + activeProperty + "\n\n";
}else {
//Add to the alert string
alertString = alertString + activeName + "\nVisible Overprint: UNAVAILABLE";
}
}
//Display to the user which of the selected files have visible overprint
alert(alertString);
Thanks so much for your help!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now