Why does not the script work

Aug 08, 2019

Copy link to clipboard

Copied

My question, why is the following script not running within the "Additional Metadata"? Entries in the document properties, e.g. Title, author, etc. work with it.

The script:

function CopyrightStatusSetzen(){

var EingabemdCopyrightStatus = app.response({

cQuestion: "Geben Sie die CopyrightStatus ein:",

cCopyrightStatus: "CopyrightStatus eingeben",

cDefault: "1975"});

if(EingabemdCopyrightStatus == null){

}

else

this.info.CopyrightStatus = EingabemdCopyrightStatus;

this.layout = "MultiplePage";

// this.layout = "SinglePage";

}

app.addToolButton({

cName: "SetCopyrightStatus",

cLabel: "CopyrightStatus setzen",

cTooltext: "CopyrightStatus setzen",

cEnable: true,

cExec: "CopyrightStatusSetzen()"});

could someone help me?

System: Windows 7; Acrobat DC

Thank you and best regards

TOPICS
Acrobat SDK and JavaScript, Windows

Views

137

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

Why does not the script work

Aug 08, 2019

Copy link to clipboard

Copied

My question, why is the following script not running within the "Additional Metadata"? Entries in the document properties, e.g. Title, author, etc. work with it.

The script:

function CopyrightStatusSetzen(){

var EingabemdCopyrightStatus = app.response({

cQuestion: "Geben Sie die CopyrightStatus ein:",

cCopyrightStatus: "CopyrightStatus eingeben",

cDefault: "1975"});

if(EingabemdCopyrightStatus == null){

}

else

this.info.CopyrightStatus = EingabemdCopyrightStatus;

this.layout = "MultiplePage";

// this.layout = "SinglePage";

}

app.addToolButton({

cName: "SetCopyrightStatus",

cLabel: "CopyrightStatus setzen",

cTooltext: "CopyrightStatus setzen",

cEnable: true,

cExec: "CopyrightStatusSetzen()"});

could someone help me?

System: Windows 7; Acrobat DC

Thank you and best regards

TOPICS
Acrobat SDK and JavaScript, Windows

Views

138

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
Aug 08, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

I miss a { after else.

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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

If I add one more I get a SyntaxError 15 in line 16

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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

Doc.info sets fields in the Info dictionary, as documented. Additional metadata is not stored there, or displayed. You can set extra fields in the Info dictionary but it won’t be merged into metadata. Standard names are automatically merged into the XML metadata, which you can read and write as a packet using Doc.metadata.

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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

Thank you for your answer, but what does that mean? Is it not possible to insert data in the "additional metadata"?

Thanks

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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Test+Screen+Name  wrote

Additional metadata is not stored there, or displayed.

That's not true. If you set a custom property under this.info it is saved and is displayed later on, under File - Properties - Custom.

For example, I've ran this code:

this.info.CopyrightStatus = "RESERVED";

Then saved and closed the file, then re-opened it, and this appears:

It's also a part of the file's raw metadata 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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

It means your code cannot work, and to update additional metadata requires a lot of study and development.

I recommend studying the PDF Specification, ISO 32000-1, to understand the different types of metadata. This may lead into study of XML in general and XFA metadata. Then you would need to update the XML metadata somehow.

So I do not say it is impossible. But you may not have the time or resources to do it.

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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

Oups.

Thanks, that's so extensive I did not know.

Many thanks

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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

Hi try67,

yes that's right, but I need the entries in the Description tab (Additional metadata), and that does not seem to be that easy or impossible?

Love from

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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

Ah no, there you can only use the built-in properties, not ones that you've added yourself.

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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

Actually, that's not quite true... If you go to Properties - Description - Additional Metadata - Advanced and expand the last item in the list, you'll see your custom properties:

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
Reply
Loading...
Aug 09, 2019 0
Aug 09, 2019

Copy link to clipboard

Copied

Hallo try67,

ja das stimmt, aber ich brauche wie gesagt die Eingaben in den Dokumenteigenschaften in dem Feld: Beschreibung (zusätzliche metadaten) und das scheint nicht zu funktionieren?!

Vielen Dank

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
Reply
Loading...
Aug 09, 2019 0