Skip to main content
Inspiring
April 7, 2023
Answered

Read part of XMP metadata other than info

  • April 7, 2023
  • 2 replies
  • 2826 views

I've added a extra node to the XMP of my PDF see screenshot from within InDesign …

And now I want to read this out from a javascript.
So I tried to read the metadata with the code

var meta = this.metadata;
var myXMPData = new XML(meta);
myrdf = new Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
p = myXMPData.myrdf::RDF.myrdf::Description;

But then I'm stuck to get the specific pdfx:PX part.
I can see it in the variable p but have no idea how to get to this pdfx:PX content in a variable to further process it's content.

Can someone help me out?

Any help will be appreciated with a big Thank You!

This topic has been closed for replies.
Correct answer LuckyLuke

It seems as simple as 

this.info.PX
result -> <checkbox>This is my checkbox</checkbox>

2 replies

LuckyLukeAuthorCorrect answer
Inspiring
April 7, 2023

It seems as simple as 

this.info.PX
result -> <checkbox>This is my checkbox</checkbox>
Legend
April 7, 2023

You've set a key pdfx:PX (correction of pdf:PX) but is PX a valid key in the http://ns.adobe.com/pdfx/1.3/ schema? 

LuckyLukeAuthor
Inspiring
April 7, 2023

I've already seen some other names in there. Because it's available in the XMP why would it make a difference then?

In the following article: https://issues.apache.org/jira/browse/PDFBOX-4961 there's someone saying pdfx is for custom stuff

Legend
April 7, 2023

Maybe that's what it's for. I thought it was for PDF/X but the schema for that is http://www.npes.org/pdfx/ns/id/ mapped as pdfxid.

But anyway, you are using the namespace http://ns.adobe.com/pdfx/1.3/ (mapped as pdfx) in the XMP, so that is what you need to reference in your code, if it's modelled on the first sample.