Add data to the description metadata of a pdf

User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Add data to the description metadata of a pdf

Post by JimmyHartington »

I would like to add metadata to the description field of the XMP info in a pdf.

This is to make it easy to visual see if a file has been processed when and by whom in our workflow.
So a customer representative can open the file and quickly the info I have added.

And it would be best it was a way to add. So if the file is processed more times I could see the history.

So in a case like where it had passed through my Switch 2 times it could look like this:
jh;2021-05-18;13.32.55;Preflight succes
bbs;2021-06-10;15.15.54;Downsample for web

I would the decide which flows add which data.

But I am at a stump about where to start. Is there any inbuilt tools in Switch to help me with this? Do I need scripting?

Image
Malcolm Mackenzie
Member
Posts: 121
Joined: Wed Mar 22, 2017 5:05 pm
Location: London, UK
Contact:

Re: Add data to the description metadata of a pdf

Post by Malcolm Mackenzie »

You could try
https://exiftool.org/
using Execute Command.
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Add data to the description metadata of a pdf

Post by Terkelsen »

Hi Jimmy,

Have you tried to use the XMP Inject object and set "XMP location path" to "dc:description"?
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: Add data to the description metadata of a pdf

Post by freddyp »

Erik's reply is spot on.

The only thing I want to contribute here is to point out that "XMP inject" is a somewhat misleading name. Yes, it can inject an entirely new XMP into a PDF, but it can also just update the XMP: it is a choice on the "Action" property of the element.
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Add data to the description metadata of a pdf

Post by Terkelsen »

Freddy, an additional question to the Update XMP.

If you update an XMP-field it will remove the existing info and replace it with the new info. I have tried to use the existing info in the XMP-field as a variable and then add a new information in order to keep the former information along with the new information. That doesn't seem to work. The new information is added but the former information inserted as a variable is missing.

Any idea why that happens?
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: Add data to the description metadata of a pdf

Post by JimmyHartington »

Thank for the info about the XMP Inject tool.
I missed it could update the info.

So I tried to make a flow. It can be downloaded here: https://d.pr/f/h1xX0R

And what I try to do is have a line of info. And when a file is processed again, then the new info needs to be added to the string.
To achieve this I set to PrivateData variables.
One which takes the old info. Named XMPCopyrightPrevious
And the other is a list of the new info. Named XMPCopyrightNew

The XMP Inject is then set to update the Copyright field with these to variables: [Job.PrivateData:Key="XMPCopyrightNew"], [Job.PrivateData:Key="XMPCopyrightPrevious"]
In my mind I should the be able to just add to this field with more info as a file is processed multiple times.

But it does not happen like this.
Switch shows me the info correctly in the Variable viewer. But the info is not added multiple times.

See these images:

Image

Image

Image

Image
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: Add data to the description metadata of a pdf

Post by JimmyHartington »

And I forgot to check the messages.
I get an error on the XMP Inject.
But can not see why it should not be able to update the field.

Image
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Add data to the description metadata of a pdf

Post by Terkelsen »

Jimmy, that was exactly what I pointed out in my earlier question. The XMP Update doesn't seem to accept variables although you are able to select variables!??
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: Add data to the description metadata of a pdf

Post by JimmyHartington »

Hi Erik

Thanks. Think I will report it to support and see what they have to say.
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: Add data to the description metadata of a pdf

Post by JimmyHartington »

I got this reply from support.
Is the dc:rights location path new or does it already exists?
If it’s new, then ‘update XMP data’ can not be used, If it's a new value for which no xmp node exists yet, this will be more difficult. The value you would want to insert would have to be added in an external XMP dataset which conforms to the RDF schema, so you could first do an XMP pickup (metadata embedded in asset) - then an export metadata - then, through scripting add the new value in the xmp file - and then use xmp inject to inject the new xmp file in the PDF. Currently, as the XMP inject tool is not able to create structured elements in XMP metadata, a Feature Request to do so exists and your details have been added to it.
So I will test some more with a field, which I can see already exists in the XMP-data.
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Add data to the description metadata of a pdf

Post by jan_suhr »

As suggested earlier, EXIF-tool will solve this for you. It can create an XMP-node if it isn't there.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
Arthur
Member
Posts: 113
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: Add data to the description metadata of a pdf

Post by Arthur »

you can also create yourself a template for the metadata you want updated and then inject that template and update all metadata that way.
The template can be easily generated via Acrobat and exported to a XMP document.

See my working flow doing exactly that.
Attachments
XMP Update.zip
(23.66 KiB) Downloaded 364 times
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: Add data to the description metadata of a pdf

Post by JimmyHartington »

Thanks for the suggestions with ExifTool.
I now got it to work.
See attached flow.

Too keep adding to the description I read the XMP Description first and save to private data at the orange folder.
It is also here I decide which info needs to be saved.

Image
Attachments
z-Add processing information to pdf.zip
(11.28 KiB) Downloaded 367 times
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: Add data to the description metadata of a pdf

Post by JimmyHartington »

And it gave some trouble when implementing in production.

So I ended up writing an XML-file for Exiftool.

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description>
<XMP-dc:Description>[Job.PrivateData:Key='XMPCopyrightNew']</XMP-dc:Description>
</rdf:Description>
</rdf:RDF>
And then Exiftool uses this to file in the commandline to add to my pdf-file.

Code: Select all

"C:/Program Files/ExifTool/exiftool.exe" -tagsfromfile %1 %2 -overwrite_original
%1 and %2 is then parameters from the Execute Command function which defines the location of the xml-file and the pdf-file.

If someone wants a flow example let me know.
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: Add data to the description metadata of a pdf

Post by magnussandstrom »

Hi Jimmy, I would love an example flow! I think this could be very useful in case of troubleshooting a file etc.
Post Reply