Javascript in action wizard for copyright notice and status needed

New Here ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Hi,

I have to batch process a number of files in Adobe DC. I'm using the action wizard and have the javascript for the title and author, but I also need the javascript for additional metadata to change 'copyright status to copyrighted' and 'copyright notice to the name of my company'. Does anyone have or know the script for that? I'm not a js expert.

Thanks

 

Paul

TOPICS
JavaScript

Views

217

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Enthusiast , Mar 18, 2021 Mar 18, 2021
Hello Paul, Add the code below to your Acrobat Action to set the 'copyright status to copyrighted' and 'copyright notice',  you'll need to plug in the Company info and web address if any, if no web address is to be added just clear the info leaving the ""I  recommend adding a second javascript tool to your action for this. var CopyrightStatus = "True"; var CopyrightNotice = "Copyright(C) 2021, Your Company Name goes here." var CopyrightInfoURL = "http://www.yourcomanyweb.com" var meta = this.me...

Likes

Translate

Translate
Most Valuable Participant ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

It's not simple, but see the document.metadata object in the JavaScript API. There seems to be an example of a very similar requirement. It would be best to start with some knowledge of XDP and XML.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Sorry this reply was for Paul...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Thanks for your reply, I managed to get the right code in this thread.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

It should be easier to use custom metadata:

 

this.info.Copyright_status = "copyrighted";
this.info.Copyright = "the name of my company";

 

 

Capture_240.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

You can certainly create custom metadata easily and call it anything you like, including "Copyright" or "My company's IP rights". These will show up on a manual inspection of the custom metadata.

 

However, that might not solve the original need. There is a standard place to keep copyright status, copyright statement, and copyright URL. This is not done with custom keywords, but is stored in the XMP metadata. This is then consistent with other formats like TIFF and JPEG when they store copyright, and utilities might report this. In Acrobat, this is shown in Document Properties -- Additional metadata -- Description. The structure of copyright info in the XMP data is complex. Info dictionary, and the info object are essentially obsolete, especially in PDF 2.0 where the Info dictionary is forbidden.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Thanks for your reply and information.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

LATEST

Thanks for your reply. Someone posted the correct code in the thread. That one didn't work for me.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Hello Paul,

 Add the code below to your Acrobat Action to set the 'copyright status to copyrighted' and 'copyright notice',  you'll need to plug in the Company info and web address if any, if no web address is to be added just clear the info leaving the ""

I  recommend adding a second javascript tool to your action for this.

 

 

var CopyrightStatus = "True";
var CopyrightNotice = "Copyright(C) 2021, Your Company Name goes here."
var CopyrightInfoURL = "http://www.yourcomanyweb.com"
var meta = this.metadata;
var myXMPData = new XML(meta);
myx = new Namespace("adobe:ns:meta/");
myrdf = new Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
mypdf = new Namespace("http://ns.adobe.com/pdf/1.3/");
myxap = new Namespace("http://ns.adobe.com/xap/1.0/");
mydc = new Namespace("http://purl.org/dc/elements/1.1/");
myxapRights = new Namespace("http://ns.adobe.com/xap/1.0/rights/");
var p = myXMPData.myrdf::RDF.myrdf::Description;

if (p.mydc::rights.myrdf::Alt.myrdf::li.toString() == "") {
p[0] += <rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<dc:rights>
<rdf:Alt>
<rdf:li xml:lang="x-default">
{CopyrightNotice}
</rdf:li>
</rdf:Alt>
</dc:rights>
</rdf:Description>
} else
p.mydc::rights.myrdf::Alt.myrdf::li = CopyrightNotice;

if (p.@myxapRights::Marked.toString() == "" ) {
p[0] += <rdf:Description rdf:about=""
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/">
<xapRights:Marked>{CopyrightStatus}</xapRights:Marked>
<xapRights:WebStatement> {CopyrightInfoURL} </xapRights:WebStatement>
</rdf:Description>
} else {
p.@myxapRights::Marked = CopyrightStatus;
p.@myxapRights::WebStatement = CopyrightInfoURL;
}
myNewXMPStr=myXMPData.toXMLString();
this.metadata = myNewXMPStr;

 

 

Regards,

Mike

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Thanks very much Mike, That code worked like a charm. 🙂 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines