Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Read part of XMP metadata other than info

Explorer ,
Apr 07, 2023 Apr 07, 2023

I've added a extra node to the XMP of my PDF see screenshot from within InDesign …Screenshot 2023-04-07 at 14.47.28.jpg

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.

Screenshot 2023-04-07 at 14.48.10.jpg

Can someone help me out?

Any help will be appreciated with a big Thank You!

TOPICS
How to , JavaScript , PDF forms
2.7K
Translate
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
1 ACCEPTED SOLUTION
Explorer ,
Apr 07, 2023 Apr 07, 2023

It seems as simple as 

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

View solution in original post

Translate
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
LEGEND ,
Apr 07, 2023 Apr 07, 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? 

Translate
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
Explorer ,
Apr 07, 2023 Apr 07, 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

Translate
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
LEGEND ,
Apr 07, 2023 Apr 07, 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. 

Translate
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
Explorer ,
Apr 07, 2023 Apr 07, 2023

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;

Screenshot 2023-04-07 at 17.12.35.jpg

I then get an error …
Can you please give me the correct syntax then?

Translate
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
LEGEND ,
Apr 07, 2023 Apr 07, 2023

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?

Translate
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
Explorer ,
Apr 07, 2023 Apr 07, 2023

I started with the online docs for the Acrobat javascript&colon; 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.

Translate
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
LEGEND ,
Apr 09, 2023 Apr 09, 2023

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...

Translate
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
Explorer ,
Apr 09, 2023 Apr 09, 2023
LATEST

Thnx again!

Keep up the good work!

Translate
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
Explorer ,
Apr 07, 2023 Apr 07, 2023

It seems as simple as 

this.info.PX
result -> <checkbox>This is my checkbox</checkbox>
Translate
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