I think I want to add "descriptions" to a file?

Started by jprokos, November 09, 2023, 01:57:34 AM

Previous topic - Next topic

jprokos

Perusing the manual and I am not entirely sure.
A scanner I have creates PDF files with the following xmp data:

File Name                       : filename.pdf
Directory                       : /Users/john
File Size                       : 325 kB
File Modification Date/Time     : 2023:10:18 14:02:36-05:00
File Access Date/Time           : 2023:11:08 16:14:26-06:00
File Inode Change Date/Time     : 2023:10:18 14:04:48-05:00
File Permissions                : -rw-r--r--
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
Page Count                      : 1
Producer                        : macOS Version 14.1 (Build 23B73) Quartz PDFContext
Creator                         : ScanSnap Home #S1100i
Create Date                     : 2023:10:18 19:02:36Z
Modify Date                     : 2023:10:18 19:02:36Z

I have another scanner and I want to add four of those same fields to it's scanned files:
Producer
Creator
Create Date
Modify Date

I tried a variety of things and was unsuccessful.

exiftool "-xmp:'Create Date'<DateTimeOriginal" "-xmp:'Modify Date'<DateTimeOriginal" -Creator="Hewlett Packard M283c" /Users/john/filename.pdf

That added a new descriptor that I didn't want:
XMP Toolkit                     : Image::ExifTool 12.60
running this those descriptors that had spaces no longer have them:
exiftool -s /Users/john/filename.pdf
ExifToolVersion                 : 12.60
FileName                        : filename.pdf
Directory                       : /Users/john
FileSize                        : 325 kB
FileModifyDate                  : 2023:10:18 14:02:36-05:00
FileAccessDate                  : 2023:11:08 23:19:15-06:00
FileInodeChangeDate             : 2023:10:18 14:04:48-05:00
FilePermissions                 : -rw-r--r--
FileType                        : PDF
FileTypeExtension               : pdf
MIMEType                        : application/pdf
PDFVersion                      : 1.3
Linearized                      : No
PageCount                       : 1
Producer                        : macOS Version 14.1 (Build 23B73) Quartz PDFContext
Creator                         : ScanSnap Home #S1100i
CreateDate                      : 2023:10:18 19:02:36Z
ModifyDate                      : 2023:10:18 19:02:36Z

I want the "Create Date" and "Modify Date" descriptors to have the same as the original file scan date.

I am not clear on how I can get the descriptor "Producer" to have that tag.

I tried this as well:
exiftool "-CreateDate<DateTimeOriginal" "-ModifyDate<DateTimeOriginal" -Creator="Hewlett Packard M283cdw" /Users/john/Library/Mobile\ Documents/com\~apple\~CloudDocs/ScanSnap\ Home/John\ Prokos/warranty\ \&\ receipts/warranty\ -\ Organic\ MATTRESS\ protector.pdf
Warning: No writable tags set from /Users/john/Library/Mobile Documents/com~apple~CloudDocs/ScanSnap Home/John Prokos/warranty & receipts/warranty - Organic MATTRESS protector.pdf
    1 image files updated

One thing worked the descriptor "Creator" and the tag I assigned

ExifTool Version Number         : 12.60
File Name                       : filname.pdf
Directory                       : /Users/john
File Size                       : 203 kB
File Modification Date/Time     : 2023:11:09 00:52:52-06:00
File Access Date/Time           : 2023:11:09 00:52:56-06:00
File Inode Change Date/Time     : 2023:11:09 00:52:55-06:00
File Permissions                : -rw-r--r--
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.4
Linearized                      : No
Page Count                      : 1
XMP Toolkit                     : Image::ExifTool 12.60
Creator                         : Hewlett Packard M283cdw

StarGeek

Quote from: jprokos on November 09, 2023, 01:57:34 AMI tried a variety of things and was unsuccessful.

exiftool "-xmp:'Create Date'<DateTimeOriginal" "-xmp:'Modify Date'<DateTimeOriginal" -Creator="Hewlett Packard M283c" /Users/john/filename.pdf

<SG edit: question moved below>

running this those descriptors that had spaces no longer have them:
exiftool -s /Users/john/filename.pdf
ExifToolVersion                : 12.60
FileName                        : filename.pdf
Directory                      : /Users/john
FileSize                        : 325 kB
FileModifyDate                  : 2023:10:18 14:02:36-05:00
FileAccessDate                  : 2023:11:08 23:19:15-06:00
FileInodeChangeDate            : 2023:10:18 14:04:48-05:00
FilePermissions                : -rw-r--r--
FileType                        : PDF
<snip>

This is FAQ #2 & 3. Without the -s (-short) option, you are seeing tag descriptions, not the tag names.  Tag descriptions will vary by the language used, but tag names don't.  Additionally , tag names never have a space in them.

QuoteThat added a new descriptor that I didn't want:
XMP Toolkit                    : Image::ExifTool 12.60

XMPToolkit is a standard tag that most programs that write XMP data add.  It can be removed from a file with -XMPToolkit=  This can be done while doing other edits to a file.

QuoteI want the "Create Date" and "Modify Date" descriptors to have the same as the original file scan date.

I tried this as well:
exiftool "-CreateDate<DateTimeOriginal" "-ModifyDate<DateTimeOriginal" -Creator="Hewlett Packard M283cdw" /Users/john/Library/Mobile\ Documents/com\~apple\~CloudDocs/ScanSnap\ Home/John\ Prokos/warranty\ \&\ receipts/warranty\ -\ Organic\ MATTRESS\ protector.pdf
Warning: No writable tags set from /Users/john/Library/Mobile Documents/com~apple~CloudDocs/ScanSnap Home/John Prokos/warranty & receipts/warranty - Organic MATTRESS protector.pdf
    1 image files updated

Here you are trying to copy the DateTimeOriginal into other tags in the file.  But if you look at your output, DateTimeOriginal doesn't exist, so that's why you get the No writable tags set warning. DateTimeOriginal is not a standard tag in PDFs, as it is more applicable to images and videos.

To set CreateDate/ModifyDate, you need to either copy from an existing tag or set it directly.  The only other date/time tags available for that file are the file system ones, FileCreateDate/FileModifyDate.  You can copy from those with
'-CreateDate<FileModifyDate' '-ModifyDate<FileModifyDate'
You could also substitute FileInodeChangeDate for FileModifyDate if that was more accurate.

Take note though that the current times in CreateDate/ModifyDate have a "Z" at the end.  This indicates that the time used is in UTC. And adjusting "2023:10:18 14:02:36-05:00" to UTC, you get "2023:10:18 19:02:36Z", so technically, the time is accurate.  I honestly don't deal with PDFs enough to know if these time stamps are supposed to be in UTC or not, but they are your files, so there's nothing wrong with making the time stamps whatever you want.  Though if you are using some other program, that program might require these time stamps to be set to UTC.F

Also, since you might be copying from the FileModifyDate, you can see that it has been changed after you edited the file with exiftool.  This is standard with file systems and one of the ways backup programs know that a file needs to be backed up.  You can keep the original FileModifyDate by adding -P (-preserve) option to your command.

You can set Producer the same way as Creator.

Try this for your command
exiftool -Creator='Hewlett Packard M283cdw' -Producer='macOS Version 14.1 (Build 23B73) Quartz PDFContext' '-CreateDate<FileModifyDate' '-ModifyDate<FileModifyDate' -XMPToolkit= /path/to/files/

Add the -P option if you want to preserve the FileModifyDate.

And if your next question was going to be about the backup (_original) files that exiftool creates, you have two options.  Either the -overwrite_original option or the  -overwrite_original_in_place option.  For Windows/Linux computers, it's usually best to use the first option but because Macs have a lot of other information, MDItem*/XAttr* file system data, you would need to use the -overwrite_original_in_place option if you want to preserve that data.  I believe the MDItem*/XAttr* data is used by Finder.  The problem with -overwrite_original_in_place is that it is slower, so it's up to use to decide which to use.

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

jprokos

#2
Not only do I appreciate you sharing all of this information with me, I appreciate the manner in which you have done so. You are very generous... thank you.

I will work on this using that guidance. Thanks again for getting me started.