Adding Custom Properties in PDF

Started by uvishwakarma, December 12, 2014, 09:01:57 AM

Previous topic - Next topic

uvishwakarma

Dear All,

I am very new to exiftool. I am trying to add XMP in the PDF from a XMP file but custom tags are not getting displayed in the PDF. My XMP file has below custom tags:

.....
         <pdfx:doi>00.0000/j.xxxx.2014.10.036</pdfx:doi>
         <pdfx:AuthoritativeDomain>
            <rdf:Bag>
               <rdf:li>google.com</rdf:li>
               <rdf:li>yahoo.com</rdf:li>
            </rdf:Bag>
         </pdfx:AuthoritativeDomain>
....

I tried this by creating local config file and succeeded in getting doi but how can I achieve adding AuthoritativeDomain with below structure:

Name                                                       Value
------------                                             ---------------
AuthoritativeDomain[0]                            google.com         
AuthoritativeDomain[1]                            yahoo.com

My config looks like:

%Image::ExifTool::UserDefined = (
  'Image::ExifTool::PDF::Info' => {
     doi => {
         Writable => 'string',
     },
     AuthoritativeDomain => {
         Writable => 'string',
     },
  },
);   
1; # end   


Please help me.

Regards,
Umesh

Phil Harvey

Hi Umesh,

Your config file defines a PDF::Info tag, but you want to write this to XMP::pdfx.  Also, AuthoritativeDomain is a List of type "Bag".  So your config file should look like this:

%Image::ExifTool::UserDefined = (
  'Image::ExifTool::XMP::pdfx' => {
     doi => {
         Writable => 'string',
     },
     AuthoritativeDomain => {
         Writable => 'string',
         List => 'Bag',
     },
  },
);   
1; # end


and the command should look something like this:

exiftool -authoritativedomain=google.com -authoritativedomain=yahoo.com -doi=00.0000/j.xxxx.2014.10.036 FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

uvishwakarma

Hi Phill,

Thanks for your quick reply.

I did tried your way but it is not appearing in the PDF. Now even doi is not coming when I changed PDF::Info to XMP::pdfx in the config file.

Actually, I am trying to embed a XMP file in the PDF which contains some user defined tags. When I open the PDF in any text editor, it does copies the XMP (using XMP::Info) but when I view it in the Acrobat Pro. none of the custom tags are visible in the "Document Properties:Custom:Custom Properties" tab.

For your reference I have attached ZIP file contains my testing files. My command line is:

exiftool -config test.cfg -authoritativedomain=google.com -authoritativedomain=yahoo.com -doi=00.0000/j.xxxx.2014.10.036 article.pdf

Just for my understanding, I would like to know when I am using a complete XMP file then why it is not possible to embed all custom tags in the PDF without any exif config.

Regards,
Umesh


Phil Harvey

Hi Umesh,

You can embed entire XMP in PDF without needing user-defined tags.

I can't see your zip file, but I wouldn't be able to download it now anyway.  It sounds to me as if your problem is explained in FAQ number 3.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

uvishwakarma

Hi Phil,

I have checked the FAQ Problem 3 but I think it will not solve my problem. If possible, please check my attached ZIP file which contains below files:

1. test.xmp (My complete XMP file)
2. article.pdf (To be updated with XMP)
3. test.cfg (exif tool config file, if requires)
4. test.sh (my command line batch file)

I am looking to add test.xmp file in to the article.pdf with all custom tags. Custom tags should be visible in Acrobat Pro. "Document Properties:Custom:Custom Properties" tab after adding XMP.

Regards,
Umesh

Phil Harvey

Hi Umesh,

Your shell script worked perfectly to write the custom XMP-pdfx tags.

However, it appears that I misunderstood your intent.  If you just want to write the XMP file as a block (ie. verbatim) into the PDF, you don't need user-defined tags, and the command is:

exiftool "-xmp<=test.xmp" article.pdf

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

uvishwakarma

Hi Phil,

Thanks for your prompt reply!!!

I did tried this but I am sorry it is not appearing in the PDF when I open it in Acrobat Pro. Please see the attached ZIP contains screenshots and a required PDF created using Acrobat Pro. which I am looking for along with my output PDF article.pdf using your suggested command line.

Regards,
Umesh

Phil Harvey

Hi Umesh,

Did you use ExifTool to confirm that the information was written?

I can't help if other software doesn't read information that you have written, other than referring you to FAQ 3.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

#8
Quote from: uvishwakarma on December 13, 2014, 09:39:59 AM
Please see the attached ZIP

Just pointing out that none of your posts have an attached file.

Maybe try uploading them to something like dropbox or google drive and then linking here?


Ignore me, my bad.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Hi StarGeek.  I can see the attachments in the last 2 posts.  But note that you may need to be logged in to see them.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

#10
Quote from: Phil Harvey on December 13, 2014, 03:13:58 PM
Hi StarGeek.  I can see the attachments in the last 2 posts.  But note that you may need to be logged in to see them.

How interesting, my bad then.

Logged in, I don't see them.  But when I open this page in a private window, they appear.  May be side effect of my new rank?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

uvishwakarma

Hi Phil,

It's Adobe Acrobat Pro. where I am checking the PDF, other than custom properties everything appears correctly. When I try adding custom tags using exif config, it does add them and are visible in the "Custom Properties" tab of Acrobat. But just I am not able to achieve array kind of entries which I mentioned earlier. See below for your reference which I am trying to get:

Acrobat Pro.::Document Properties:Custom:Custom Properties:

Name                                                       Value
------------                                             ---------------
AuthoritativeDomain[0]                            google.com         
AuthoritativeDomain[1]                            yahoo.com


When I try in command line, it adds the custom tags but not as a separate entry but separated by comma. See below my command line:

exiftool -config test.cfg -authoritativedomain=google.com -authoritativedomain=yahoo.com -doi=00.0000/j.xxxx.2014.10.036 article.pdf


It appears in the PDF as:

Name                                                       Value
------------                                             ---------------
AuthoritativeDomain                            google.com, yahoo.com


Please help me, it seems to me as if I am missing something here but it can be done through exif tool.

Thanks,
Umesh

Phil Harvey

You can confirm by looking at the XMP that the values are stored as separate items in an XMP Bag:

exiftool -xmp -b article.pdf

If so, then the are stored correctly.  I can't answer about how they are displayed in Acrobat Pro.  That is a question for an Adobe forum.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

uvishwakarma

Thanks Phil for all your support and listening to my all silly queries.

I tried this and XMP is embedded properly in the PDF but it is not showing in the "Custom Properties" tab of Acrobat. I'll definitely try to open a forum in Adobe but could you please help me if I can create a exif config file that should add custom tags like:

%Image::ExifTool::UserDefined = (
  'Image::ExifTool::PDF::Info' => {
     doi => {
         Writable => 'string',
     },
     AuthoritativeDomain[0] => {
         Writable => 'string',
     },
     AuthoritativeDomain[1] => {
         Writable => 'string',
     },
  },
);   
1; # end   

my command line should look like:

exiftool -config test.cfg -authoritativedomain[0]=google.com -authoritativedomain[1]=yahoo.com -doi=00.0000/j.xxxx.2014.10.036 article.pdf


Regards,
Umesh

Phil Harvey

Hi Umesh,

You keep running me around in circles.  Now we're back to writing PDF Info instead of XMP.  If you post a file with the PDF  information formatted in the way you want, I'll see if I can figure out how to write this with ExifTool.  Writing a custom List-type PDF Info tag is not something I remember anyone wanting to do before.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).