ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: tobwen on April 16, 2022, 02:28:45 AM

Title: PDF-metadata: "author" isn't written (or overwritten by "creator")
Post by: tobwen on April 16, 2022, 02:28:45 AM
Bug
Author isn't set correctly, when changing the metadata of a PDF. It's equal to or overwritten by Creator.

How to repoduce

# get rid of all the metadata
exiftool -all= -xmp:all= 01.pdf -o 02.pdf

# set Author, Creator, Producer, Subject, Title
exiftool -Author=a -Creator=b -Producer=c -Subject=d -Title=e 02.pdf -o 03.pdf


Expected output

Received output

Additional details

Note
Because the search is currently down, I can't check if the error has already been reported. See https://exiftool.org/forum/index.php?topic=13493.0
Title: Re: PDF-metadata: "author" isn't written (or overwritten by "creator")
Post by: Moonbase59 on April 16, 2022, 06:07:40 AM
Just gave it a try, using exiftool 12.41 on Manjaro Linux, works fine here:

exiftool -Author=a -Creator=b -Producer=c -Subject=d -Title=e test.pdf -o test2.pdf


exiftool -G1 -a -s test2.pdf

[ExifTool]      ExifToolVersion                 : 12.41
[System]        FileName                        : test2.pdf
[System]        Directory                       : .
[System]        FileSize                        : 2.2 MiB
[System]        FileModifyDate                  : 2022:04:16 11:56:51+02:00
[System]        FileAccessDate                  : 2022:04:16 11:56:50+02:00
[System]        FileInodeChangeDate             : 2022:04:16 11:56:51+02:00
[System]        FilePermissions                 : -rw-r--r--
[File]          FileType                        : PDF
[File]          FileTypeExtension               : pdf
[File]          MIMEType                        : application/pdf
[PDF]           PDFVersion                      : 1.5
[PDF]           Linearized                      : No
[PDF]           Author                          : a
[PDF]           CreateDate                      : 2010:10:03 19:14:43-05:00
[PDF]           Creator                         : b
[PDF]           ModifyDate                      : 2010:10:03 19:14:43-05:00
[PDF]           Producer                        : c
[PDF]           Title                           : e
[PDF]           Subject                         : d
[PDF]           PageMode                        : UseOutlines
[PDF]           PageCount                       : 135
[XMP-x]         XMPToolkit                      : Image::ExifTool 12.41
[XMP-dc]        Creator                         : b
[XMP-dc]        Format                          : application/pdf
[XMP-dc]        Subject                         : d
[XMP-dc]        Title                           : e
[XMP-pdf]       Author                          : a
[XMP-pdf]       Producer                        : c
[XMP-xmp]       CreateDate                      : 2010:10:03 19:14:43-05:00
[XMP-xmp]       CreatorTool                     : AH Formatter V5.1 R1 (5,1,2009,0914) for Windows
[XMP-xmp]       ModifyDate                      : 2010:10:03 19:14:43-05:00
[XMP-xmpMM]     DocumentID                      : uuid:f562fec8-af7c-4c98-8fa8-7127dc17a0b3
[XMP-xmpMM]     InstanceID                      : uuid:41d59bd8-0883-4d91-9980-a4e64b31e231


Using qpdfview: (see attached screenshot)
Title: Re: PDF-metadata: "author" isn't written (or overwritten by "creator")
Post by: StarGeek on April 16, 2022, 10:44:40 AM
This is FAQ #3 (https://exiftool.org/faq.html#Q3).  If a different program reads different tags and gives them a different name than the actual tag name, it's not an error in exiftool.

What name Adobe Reader gives isn't always the name of the actual tag in the file.  Additionally, Reader may be reading from both PDF Tags (https://exiftool.org/TagNames/PDF.html), which is actually an older stander, and XMP tags (https://exiftool.org/TagNames/XMP.html), which I believe get priority in Reader.

Running your command and looking at the locations with FAQ #3, you'll see that Creator is written to two different tags, PDF:Creator and XMP-dc:Creator.  And XMP-dc:Creator is the correct place to put the author of the file according to the standards.
C:\>exiftool -P -overwrite_original -Author=a -Creator=b -Producer=c -Subject=d  Y:\!temp\test.pdf
    1 image files updated

C:\>exiftool -G1 -a -s -e --file:all Y:\!temp\test.pdf
[ExifTool]      ExifToolVersion                 : 12.41
[PDF]           PDFVersion                      : 1.4
[PDF]           Linearized                      : No
[PDF]           PageCount                       : 68
[PDF]           Author                          : a
[PDF]           Creator                         : b
[PDF]           Producer                        : c
[PDF]           Subject                         : d
[XMP-x]         XMPToolkit                      : Image::ExifTool 12.41
[XMP-dc]        Creator                         : b
[XMP-dc]        Subject                         : d
[XMP-pdf]       Author                          : a
[XMP-pdf]       Producer                        : c


So instead of just writing to Creator, you want to specify the group you want to write to.  In this case, you most likely want to write to PDF:Creator and XMP-pdf:Creator.  Note that the latter tag is marked as "avoid" because XMP-dc:Creator is the much more common tag.  See XMP pdf Tags (https://exiftool.org/TagNames/XMP.html#pdf).