Output XMP metadata to dynamic stamps

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

involve39
User
Posts: 19
Joined: Thu Aug 29, 2024 10:04 am

Output XMP metadata to dynamic stamps

Post by involve39 »

Hi,

I was wondering if it's possible to grab specific fields from the XMP metadata and insert them into a dynamic stamp.

For example, I can access the "Title" field from the standard PDF metadata via JavaScript using:

Code: Select all

console.println(this.info.Title);
I can also get the whole XML blob for the XMP metadata with:

Code: Select all

console.println(this.metadata);
What I'm missing is a way to extract one or more fields from the XML string, for example:

Code: Select all

[XMP-fx]        Document Type                   : INVOICE
[XMP-fx]        Document File Name              : factur-x.xml
Does anyone have any ideas or pointers?

Thanks!
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12216
Joined: Wed Jan 03, 2018 6:52 pm

Re: Output XMP metadata to dynamic stamps

Post by Daniel - PDF-XChange »

Hello, involve39

If anyone else has ideas, that would be appreciated. I have asked the dev team for input on this, but they have been quite busy of late so I cannot promise how quickly we will see a reply (and I am not an expert on JS - creating something new is not my forte)

[Edit] Quick update, I have a reply, but possibly not the one you were looking for:
we provide XML data as a string, and it up to the user how to deal with that xml data. We do not provide any XML functionality and the JS engine we use does not support the deprecated ECMA XML extension.
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
involve39
User
Posts: 19
Joined: Thu Aug 29, 2024 10:04 am

Re: Output XMP metadata to dynamic stamps

Post by involve39 »

Hi Dan,

thanks for your reply!

Indeed, it's too bad that there's no way to parse the XML.

I was also looking at Run JavaScript in PDF Tools, to see if I can use JavaScript to get the values into my stamp.
Unfortunately, that appears to be another dead end, since there doesn't seem to be a way to pass dynamic values into the Tools_DoWork() function.

In general, that looks to me like a bit of a weak spot in PDF Tools, that I keep bumping up against.
None of the various tools like Run JavaScript, Execute application or Change document properties support arbitrary variables, which is why I have to fall back on PowerShell and 3rd party PDF apps for various workflows.
User avatar
Sean - PDF-XChange
Site Admin
Posts: 629
Joined: Wed Sep 14, 2016 5:42 pm

Re: Output XMP metadata to dynamic stamps

Post by Sean - PDF-XChange »

Hi involve39,

Sorry that you could not get a satisfacory resolution here - let's wait to see what the development team will say.

Kind regards,
Sean Godley
Technical Writer
PDF-XChange Co LTD
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623