[solved] Delete tags with -tagsfromfile / Can't make it work..

Started by Ste, November 06, 2013, 02:42:58 AM

Previous topic - Next topic

Ste

Hi Phil,
i browsed the forum, the faq and the doc... but i could not make work the standard
exiftool -all= -tagsFromFile @ -TAG FILE

I'm working with pdf's here, and trying to clean the XMP group.
An example output of my PDF tags would be for instance:

---- ExifTool ----
ExifToolVersion              : 9.39
---- File ----
FileName                       : FILE.pdf
Directory                       : .
FileSize                          : 57 MB
FileModifyDate               : 2013:11:05 12:59:32+01:00
FileAccessDate               : 2013:11:06 08:26:24+01:00
FileInodeChangeDate     : 2013:11:05 12:59:32+01:00
FilePermissions              : rw-r--r--
FileType                        : PDF
MIMEType                     : application/pdf
---- PDF ----
PDFVersion                    : 1.3
Linearized                      : No
PageCount                     : 411
PDFVersion                    : 1.4
Title                               : myTitle
Author                           : myAuthor
Subject                          : mySubject
Producer                        : Mac OS X 10.8.5 Quartz PDFContext
Creator                          : myCreator
CreateDate                     : 2013:11:05 11:44:34Z
ModifyDate                     : 2013:11:05 11:44:34Z
---- XMP ----
Publisher                       : myPublisher
DocChangeCount           : 6297
Trapped                         : False
MetadataDate                : 2010:10:19 16:43:46+01:00
ModifyDate                    : 2010:10:19 16:43:46+01:00
PageImageFormat         : JPEG, JPEG
PageImageHeight          : 256, 256


Let's suppose i want to clear all the XMP group BUT the -Publisher tag.

i tried:
exiftool -all= -tagsFromFile @ -XMP:Publisher FILE.pdf
and
exiftool -all= -tagsFromFile @ -Publisher FILE.pdf
and
exiftool -XMP:all= -tagsFromFile @ -XMP:Publisher FILE.pdf
And many other subtle variations...
but it didn't work. All the XMP tags are erased and none is saved, whatever tag i try to preserve.

I'm clearly missing something here, either i do a syntax error, either it's cause i'm working with pdf or i didn't really understand how i should do...
I hope you may enlighten me  :)

Thanks for your time and help, your exiftool utility is wonderful! :)
Ste.

Phil Harvey

#1
Excellent!  You've found a bug in ExifTool.  This feature wasn't working properly for PDF files.  At the same time I will make XMP the preferred group when writing PDF files, as it should have been.  Both problems are fixed by the same patch.  This fix will appear in the next release (version 9.40), probably within a few days.

Thanks!! And sorry for the inconvenience.

- Phil

Edit:  I should point out that the original information is never actually deleted when removing tags from a PDF file, in case this may be a problem for you.  See the PDF Tags documentation for details.
...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 ($).

Ste

Well... happy to have been helpful  :D

is the incremental update of metadata a native pdf feature or a choice made in the exiftool development?
In this latter case may I do a feature request for a flag to edit the metadata in a not-incremental way?

Thanks again, i'll wait the patch  :)

Phil Harvey

The incremental update was sort of a necessity because the PDF format is extremely complex and restructuring the file to actually remove the old metadata would be much slower and much more work in programming.

The good news is that you should be able to run the output through a PDF distiller to re-normalize the file after editing with ExifTool.

- 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 ($).

Ste

Yes, i confirm it works with pdftops and back with pstopdf : no more previous ExifTool Update.
Thanks again Phil!
Ste.

Phil Harvey

ExifTool 9.40 is now available.  Please let me know if it doesn't solve the problem of adding back XMP tags.

- 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 ($).

Ste

Works like a charm  :D

To clear the ExifTool update data the best solution i found is using qpdf
qpdf --linearize in.pdf out.pdf

This doesn't involve any complex post script reprocessing and effectively clears the ExifTool update data.

I'm sure other people will be interested too, i'l spread the word  :)
Thanks again!

Phil Harvey

Thanks for the linearize command.  That is useful information.

- 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 ($).