Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
It seems as simple as
this.info.PX
result -> <checkbox>This is my checkbox</checkbox>Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
do you mean like this?
var meta = this.metadata;
var myXMPData = new XML(meta);
myrdf = new Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
mypdfx = new Namespace("http://ns.adobe.com/pdfx/1.3/");
myXMPData.myrdf::mypdfx::PX;I then get an error …
Can you please give me the correct syntax then?
Copy link to clipboard
Copied
Which Adobe doc talks about new XML and Namespace? I don't see it. I assumed your were modifying an existing working model, but maybe not?
Copy link to clipboard
Copied
I started with the online docs for the Acrobat javascript: https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/doc.html#metadata
There's a rather large example to change or add metadata in the XMP.
Because I got a result with my first part of the script I thought it was teh way to go.
Thnx for all your reactions.
Copy link to clipboard
Copied
Well, I'm usually pretty good with docs, but I found that baffling, until I found the reference to E4X. It turns out that this is an extension to JavaScript to handle XML. Adobe don't explain it, beause it's just there. Here is something that might help: Yahoo! Developer Network - Flash Developer Center - Articles - E4X: Beginner to Advanced (archive.or...
Copy link to clipboard
Copied
Thnx again!
Keep up the good work!
Copy link to clipboard
Copied
It seems as simple as
this.info.PX
result -> <checkbox>This is my checkbox</checkbox> 
					
				
				
			
		
 
					
				
				
			
		
Find more inspiration, events, and resources on the new Adobe Community
Explore Now