News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

PDF Custom properties

Started by sumit07, October 15, 2012, 08:12:05 AM

Previous topic - Next topic

sumit07

Hi Phil

I am adding custom properties to pdf file using

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::PDF::Info' => {
        TestTag => { },
    },
);

But  I am not able to remove it.
Could you please suggest a solution.
Thanks

Phil Harvey

#1
Try this:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::PDF::Info' => {
        TestTag => {
            Writable => 'string',
        },
    },
);


- Phil

Edit:  Silly me.  You can already write this value, so this won't do anything.  To delete the value, use exiftool -testtag= FILE
...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 ($).

sumit07

Hi Phil,

Suppose I try to add a xmp metadata to a pdf file , for eg TestTag = somevalue. It gets added as Test Tag with a space in between. And when I try to change the value using exiftool.exe from cmd it says tag doesn't exist. What can be reason for that and how can i solve it.

Phil Harvey

Does this help?:

> exiftool a.pdf -testtag="this is a test"
    1 image files updated
> exiftool a.pdf -testtag
Test Tag                        : this is a test
> exiftool a.pdf -testtag -s
TestTag                         : this is a test
> exiftool a.pdf -testtag=
    1 image files updated
> exiftool a.pdf -testtag
>


- 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 ($).

sumit07

I did try this But the problem with this is it removes the value but the attribute stil remains and can be seen in custom document properties as well as if seen from cmd exiftool with attribute name and value as a blank.

sumit07

stil it has the same problem tag doesnt exist

Phil Harvey

I have merged these two threads together.  When you say "tage doesnt exist", do you mean you can't write the value of TestTag?  Are you using the config file you posted?  I need more details to be able to understand what you are doing.  If you show your console log it would be useful.

- 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 ($).

sumit07

Hi Phil,

I have a doubt here. How can retrieve all custom properties added to a pdf that are stored using

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::PDF::Info' => {
        $Name => { },

    },
);

The pdf may have custom propperties as
Name     Value
test         test
test1        test1

-sumit


Phil Harvey

Hi Sumit,

ExifTool will read any PDF Info tags that exist.  They only need to be pre-defined if you want to write 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 ($).

sumit07

Hi Phil

If I want to read only the custom properties and not other values lyk author or title. How am i suppose to do that using code.

sumit07

Or suppose i write XMP metadata to pdf in a particular namespace say XYZ

How can i retrieve all values that are in the namespace XYZ

Phil Harvey

There are no namespaces in the PDF Info.  If you are talking about XMP, this is done with -xmp-namespace:all.

- 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 ($).

sumit07

yeah i am talking about xmp not info dictionary

sumit07

could u plz write a code for  the same

Phil Harvey

The sample config file contains an example of how to create a new XMP namespace.

- 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 ($).