ExifTool Forum

ExifTool => Newbies => Topic started by: Pman on August 30, 2024, 09:13:20 AM

Title: Overwrite original PDF
Post by: Pman on August 30, 2024, 09:13:20 AM
Finally after hours of trying I got as close as getting the meta dates changed.
No I want to overwrite the original PDF but no success yet.
Hope you can help.
This is what I got so far:
exiftool -time:all -G1 -a -s -overwrite_original "file.pdf"


Title: Re: Overwrite original PDF
Post by: StarGeek on August 30, 2024, 10:54:24 AM
What is the exact command you are using and the exact output. Simply copy/paste the results here and use the code button (the one with <>). Actual text is easier to read than an image.

Example of working command (anything that is ICC should always be ignored)
C:\>exiftool -time:all --system:all -G1 -a -s Y:\!temp\Test_D10000690C.pdf
[ICC-header]    ProfileDateTime                 : 1998:02:09 06:49:00
[XMP-xmp]       CreateDate                      : 2018:08:08 14:55:54+03:00
[XMP-xmp]       ModifyDate                      : 2018:08:08 14:55:54+03:00
[PDF]           CreateDate                      : 2018:08:08 14:55:54+03:00
[PDF]           ModifyDate                      : 2018:08:08 14:55:54+03:00

C:\>exiftool -P -overwrite_original -CreateDate="2024:08:30 12:00:00-08:00" -ModifyDate="2024:08:30 12:00:00-08:00" Y:\!temp\Test_D10000690C.pdf
    1 image files updated

C:\>exiftool -time:all --system:all -G1 -a -s Y:\!temp\Test_D10000690C.pdf
[ICC-header]    ProfileDateTime                 : 1998:02:09 06:49:00
[XMP-xmp]       CreateDate                      : 2024:08:30 12:00:00-08:00
[XMP-xmp]       ModifyDate                      : 2024:08:30 12:00:00-08:00
[PDF]           CreateDate                      : 2024:08:30 12:00:00-08:00
[PDF]           ModifyDate                      : 2024:08:30 12:00:00-08:00
Title: Re: Overwrite original PDF
Post by: Pman on August 30, 2024, 03:03:21 PM
Hi StarGeek,

Yeah, sorry for the picture disaster.
Couldn't even get that to work.  :D
I was using this:

exiftool -time:all -G1 -a -s -overwrite_original "file.pdf"

I was just trying every line I could find but it didn't work so far.
But your code works like a charm.

By the way...I had to write the line without the > after C:\

Thank you so much!
This is really nice...
Title: Re: Overwrite original PDF
Post by: StarGeek on August 30, 2024, 04:30:55 PM
That command doesn't set anything, it only displays the data.

I was copy/pasting directly from the command line, which is why the C:\> was included. That's the command line prompting you to enter a command.
Title: Re: Overwrite original PDF
Post by: Pman on August 30, 2024, 05:31:00 PM
This is what I get if I keep the >:

C:\Users\jep36>C:\>exiftool -time:all --system:all -G1 -a -s C:\Users\jep36\Downloads\test2.pdf
'C:\' is not recognized as an internal or external command,
operable program or batch file.
Title: Re: Overwrite original PDF
Post by: Pman on August 31, 2024, 01:46:49 PM
I've also added this code to change the Meta data date:

-MetadataDate="2024:08:28 08:58:34-08:00"

I'm getting the hang of it!  :D
Title: Re: Overwrite original PDF
Post by: StarGeek on August 31, 2024, 03:09:56 PM
Now it's time to let you know that changes to PDFs made by exiftool are reversible.

My copy/paste on the subject

Exiftool uses the incremental update function of PDFs to update the files (see "Incremental Updates in PDF files", Debenu Foxit (https://www.debenu.com/kb/incremental-updates/)). This does not remove any previous data and such changes are reversible. In order to make the changes permanent, the file needs to be re-liniarized by a program such as Adobe Acrobat (see here (https://community.adobe.com/t5/acrobat-sdk-discussions/linearizing-a-pdf/td-p/8366236)) or qpdf (https://github.com/qpdf/qpdf) (run qpdf --linearize --replace-input file.pdf).