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.
Sounds like more than one Title tag - what does "exiftool -a -G1 -title Book.pdf" give you?
[PDF] Title : Old title
[XMP-dc] Title : Old title
Indeed, multiple Title tags.
What can I do, in my perl script or cli ?
I was expecting the tags to have different values.
Doubtless Phil will have the answer - are you able to share a problem file?
It's a big file of copyrighted content.
I can send a link to the file as private message.
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).
Send me the file and I'll take a look (philharvey66 at gmail.com)
- Phil
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
Indeed. After upgrading the module, all works fine.
Thanks for your time.