Please help: changing CreateDate & ModifyDate in a PDF

Started by LisaMalloy128, January 14, 2024, 11:13:02 AM

Previous topic - Next topic

LisaMalloy128

Hello, I'm new to working in Terminal, so I'm a real newbie. I need to change the CreateDate and clear the ModifyDate in a PDF. Using ExifTool, I was able to locate the PDF in Terminal, but I don't know how to do the next step(s): give the command to change the CreateDate to an exact one I have in mind. (For this command, let's just say I want to change the date to February 4, 2024.). Additionally, I would like to have the "ModifyDate" be blank. Could someone please help with these commands? THANK YOU!!

StarGeek

The question is which "create date" and "modify date" are you trying to change, as there are multiple tags that fall under these names and different programs will read different ones. For example, if you are checking the dates from the desktop, then odds are you are seeing the file system time stamps, while viewing it with a PDF program, you are probably seeing the dates that are embedded in the file.

Run this command to view all the date/time tags in the file
exiftool -time:all -G -a -s file.pdf

Compare the output to what you are seeing elsewhere to figure out the name of the tag you want to edit.

Using your example date/time, your basic command would be something like, assuming you want to change the file system time stamps.
exiftool -FileCreateDate="2024:02:04 12:00:00" -FileModifyDate="2024:02:04 12:00:00" file.pdf

Note that most date/time tags require a time as well as a date.  Also, there are tags, like the above file system ones, that cannot be removed.

To try and remove a tag, you would take the tag name and set it to be blank.  For example, if you were trying to remove the embedded ModifyDate, you would use
exiftool -ModifyDate= file.pdf

One very important thing to understand is that any change made to a PDF by exiftool is reversible. Exiftool uses the incremental update property of PDFs which does not clear the previous data. To make the changes permanent, you have to use a program to re-liniarize.  The PDF Tags page gives an example using the command line program, QPDF.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

LisaMalloy128

#2
Hi, thanks so much for your reply.

I tried running the command after identifying my file (using the command:
exiftool -a -G1 -s d [path/my file name].pdf
and it gave me this:

Warning: Error 256 running "/usr/bin/setfile" to set FileCreateDate - [path/my file name].pdf
It then said "one image file updated", but when I checked my doc (viewing the File->Properties) nothing had been changed.

Can you please advise?


StarGeek

From a previous post
Quote from: Phil Harvey on May 02, 2020, 07:03:03 AMNote that you need the "setfile" utility on MacOS to set FileCreateDate.  You can install this with "xcode-select --install".
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

The FileModifyDate should have been changed, but you'll need to install "setfile" to be able to change FileCreateDate.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

LisaMalloy128

Hi Phil!

I guess I'm too much of a newbie. I don't know how to install the Setfile utility (tried pasting your command into Terminal and nothing happened).

I've spent the better part of today trying to figure out how to change the dates on my PDF - I think I may give up before I get too frustrated.

Though I do appreciate your help.