ExifTool Forum

ExifTool => Newbies => Topic started by: sumit07 on October 15, 2012, 08:12:05 AM

Title: PDF Custom properties
Post by: sumit07 on October 15, 2012, 08:12:05 AM
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
Title: Re: PDF Custom properties
Post by: Phil Harvey on October 15, 2012, 08:15:31 AM
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
Title: Pdf metadata
Post by: sumit07 on October 15, 2012, 08:33:44 AM
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.
Title: Re: Pdf metadata
Post by: Phil Harvey on October 15, 2012, 08:38:50 AM
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
Title: Re: PDF Custom properties
Post by: sumit07 on October 15, 2012, 09:18:53 AM
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.
Title: Re: Pdf metadata
Post by: sumit07 on October 15, 2012, 09:24:36 AM
stil it has the same problem tag doesnt exist
Title: Re: PDF Custom properties
Post by: Phil Harvey on October 15, 2012, 12:25:41 PM
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
Title: Re: PDF Custom properties
Post by: sumit07 on October 17, 2012, 08:29:52 AM
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

Title: Re: PDF Custom properties
Post by: Phil Harvey on October 17, 2012, 08:41:58 AM
Hi Sumit,

ExifTool will read any PDF Info tags (https://exiftool.org/TagNames/PDF.html#Info) that exist.  They only need to be pre-defined if you want to write them.

- Phil
Title: Re: PDF Custom properties
Post by: sumit07 on October 17, 2012, 08:47:05 AM
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.
Title: Re: PDF Custom properties
Post by: sumit07 on October 17, 2012, 08:49:26 AM
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
Title: Re: PDF Custom properties
Post by: Phil Harvey on October 17, 2012, 08:56:57 AM
There are no namespaces in the PDF Info.  If you are talking about XMP, this is done with -xmp-namespace:all.

- Phil
Title: Re: PDF Custom properties
Post by: sumit07 on October 17, 2012, 09:18:25 AM
yeah i am talking about xmp not info dictionary
Title: Re: PDF Custom properties
Post by: sumit07 on October 17, 2012, 09:21:23 AM
could u plz write a code for  the same
Title: Re: PDF Custom properties
Post by: Phil Harvey on October 17, 2012, 08:55:06 PM
The sample config file (https://exiftool.org/config.html) contains an example of how to create a new XMP namespace.

- Phil
Title: Re: PDF Custom properties
Post by: sumit07 on October 18, 2012, 01:57:59 AM
Hi Phil
Sorry to bug u but I am talking about how to retrieve it using code not cmd line
Title: Re: PDF Custom properties
Post by: Phil Harvey on October 18, 2012, 07:01:49 AM
Sorry, I didn't understand.

use Image::ExifTool qw(:Public);
my $info = ImageInfo('image.jpg', 'XMP-namespace:all');


- Phil
Title: Re: PDF Custom properties
Post by: sumit07 on February 11, 2013, 06:13:33 AM
Hi Phil,

Is there any way to validate Pdf using exiftool or see if the xref table is valid

Thanks,
Sumit
Title: Re: PDF Custom properties
Post by: Phil Harvey on February 11, 2013, 07:08:09 AM
Hi Sumit,

ExifTool is not a validation tool, but it will report some errors/warnings that you can retrieve like this:

exiftool -error -warning FILE

- Phil
Title: Re: PDF Custom properties
Post by: sumit07 on February 28, 2013, 08:14:55 AM
Hi Phil

I am trying to add custom properties to a pdf, but it says invalid xref. could you plz help me with this

-sumit
Title: Re: PDF Custom properties
Post by: Phil Harvey on February 28, 2013, 11:01:45 AM
If you can send me the PDF (philharvey66 at gmail.com), I'll take a look.

- Phil
Title: Re: PDF Custom properties
Post by: sumit07 on March 01, 2013, 03:19:55 AM
Hi Phil.

I  have send the mail and also attached the file in this commnet . Please have a look.

-sumit
Title: Re: PDF Custom properties
Post by: Phil Harvey on March 01, 2013, 07:51:30 AM
Hi Sumit,

Thanks for the sample.  ExifTool was not parsing the XREF table of this PDF properly.  This problem will be fixed in ExifTool 9.21, which will likely be released tomorrow.

- Phil
Title: Re: PDF Custom properties
Post by: sumit07 on March 01, 2013, 08:00:07 AM
Hi Phil,

We are using the perl module Image::Exiftool for reading and writing pdf properties.
Will this update be available in this module too ?


-sumit
Title: Re: PDF Custom properties
Post by: Phil Harvey on March 01, 2013, 10:13:41 AM
Yes.

- Phil
Title: Re: PDF Custom properties
Post by: sumit07 on March 04, 2013, 03:06:19 AM
Hi Phil,


This works like a charm. Thanks a lot again :)

-sumit