ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: habett on February 23, 2020, 06:35:16 AM

Title: Unmatching PDF metadata
Post by: habett on February 23, 2020, 06:35:16 AM
I took quite a long time looking for bugs in my perl code supposed to modify and read PDF metadata. I just couldn't get it right.
When trying to point at minimal code of what's wrong, here's an example on my ubuntu terminal cli with exifTool version 10.80 :

exiftool Book.pdf  -title='New title'
Output -> 1 image files updated
exiftool Book.pdf -title
Output -> Old title

pdfinfo Book.pdf | grep Title
output -> Title: New title

When I check with acrobat or Evince, I see the 'New title" title but in exiftool or Image::ExifTool I can only see the old title.
File permisions on the system are not an issue but I guess there must be something wrong with my Book.pdf as the problem only appears here in my pool of test files.
Image::ExifTool::CanWrite('Book.pdf') returns 1
$exifTool->WriteInfo('Book.pdf) turns 1
XMPToolkit is Adobe XMP Core 5.2-c001 63.139439, 2010/09/27-13:37:26
no copyright field.

I don't know what to do.
Title: Re: Unmatching PDF metadata
Post by: greybeard on February 23, 2020, 07:17:29 AM
Sounds like more than one Title tag - what does "exiftool -a -G1 -title Book.pdf" give you?
Title: Re: Unmatching PDF metadata
Post by: habett on February 23, 2020, 07:20:42 AM
[PDF]           Title                           : Old title
[XMP-dc]        Title                           : Old title
Title: Re: Unmatching PDF metadata
Post by: habett on February 23, 2020, 08:38:19 AM
Indeed, multiple Title tags.

What can I do, in my perl script or cli ?
Title: Re: Unmatching PDF metadata
Post by: greybeard on February 23, 2020, 08:46:54 AM
I was expecting the tags to have different values.

Doubtless Phil will have the answer - are you able to share a problem file?
Title: Re: Unmatching PDF metadata
Post by: habett on February 23, 2020, 09:11:57 AM
It's a big file of copyrighted content.

I can send a link to the file as private message.
Title: Re: Unmatching PDF metadata
Post by: StarGeek on February 23, 2020, 10:57:35 AM
I just wanted to mention, in case you hadn't already read it, that any PDF edits that exiftool does are reversible unless the PDF is re-linearized.  Take a look at the 3rd paragraph at the top of the PDF tag page (https://exiftool.org/TagNames/PDF.html).
Title: Re: Unmatching PDF metadata
Post by: Phil Harvey on February 23, 2020, 11:17:12 AM
Send me the file and I'll take a look (philharvey66 at gmail.com)

- Phil
Title: Re: Unmatching PDF metadata
Post by: Phil Harvey on February 23, 2020, 08:54:50 PM
I got your PDF file, but I don't see the same thing as you.

This is what I get when running the current version of ExifTool (11.88):

> exiftool tmp/Book.pdf -title -a -G1
[PDF]           Title                           : Dope
[XMP-dc]        Title                           : Dope
> exiftool tmp/Book.pdf -title="new title"
    1 image files updated
> exiftool tmp/Book.pdf -title -a -G1
[PDF]           Title                           : new title
[XMP-dc]        Title                           : new title


Which is what I would expect.

- Phil
Title: Re: Unmatching PDF metadata
Post by: habett on February 24, 2020, 12:47:49 AM
Indeed. After upgrading the module, all works fine.

Thanks for your time.