Delete all XMP tags except Creation/Modified Dates

Started by uvishwakarma, May 12, 2015, 04:36:06 AM

Previous topic - Next topic

uvishwakarma

Dear All,

I am trying to use "exiftool -all:all=" command line to delete all XMP metadata information from the PDF file. Although it deletes XMP metadata but also removes date and time information from the PDF file. Could you please let me know how I can preserve date and time information in the PDF and delete XMP metadata, I am using Acrobat to view PDF information.

I am sharing with you two PDF files:

1. article.pdf: Original one
2. article_out.pdf: After running command line "exiftool -all:all= -o article_out.pdf article.pdf"

Thanks for all your support.

Regards,
Umesh Vishwakarma

Phil Harvey

Hi Umesh,

To delete only XMP, use -xmp:all=

If you also want to preserve XMP date/time tags, use -xmp:all= "-all:all<xmp:time:all"

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

uvishwakarma

Hi Phil,

Thanks for your quick response!!!

I have tried to use "-xmp:all=" but XMP information is still visible in Acrobat, however when I use command line "exiftool -all:all= -o article_out.pdf article.pdf" then XMP is not visible in Acrobat but it just deletes date information.

Please suggest, actually I need to delete other information as well from the PDF like PDF Producer, Application, etc. therefore I want to use "-all:all" option.

Regards,
Umesh

Hayo Baan

Quote from: uvishwakarma on May 12, 2015, 07:53:21 AM
I have tried to use "-xmp:all=" but XMP information is still visible in Acrobat, however when I use command line "exiftool -all:all= -o article_out.pdf article.pdf" then XMP is not visible in Acrobat but it just deletes date information.

I think Adobe is showing you the info from the IPTC when it doesn't find the XMP. Try adding -IPTC:All=

Hope this helps,
Hayo
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

You can use -all:all= "-all:all<pdf:time:all" to delete all then recover the PDF date/time 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 ($).

uvishwakarma

Hi Phil,

I tried -all:all= "-all:all<pdf:time:all" but still date information disappears from the PDF when I see it in Acrobat. Finally I followed below steps in my program and successfully preserved date and time information:

1. Extract XMP from the PDF
2. Get original dates from the XMP using XPath (//xmp:CreateDate and //xmp:ModifyDate)
3. Write new date XMP with date information as:
      ...
      <rdf:Description rdf:about=\"\"
            xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\"
            xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\"
            xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
            xmlns:pdfx=\"http://ns.adobe.com/pdfx/1.3/\"
            xmlns:pdfxid=\"http://www.npes.org/pdfx/ns/id/\"
            xmlns:xmpMM=\"http://ns.adobe.com/xap/1.0/mm/\">
         <xmp:CreateDate>$origCreateDate</xmp:CreateDate>
         <xmp:ModifyDate>$origModifyDate</xmp:ModifyDate>
         <xmp:CreatorTool>Elsevier</xmp:CreatorTool>
      </rdf:Description>
      ...
4. Run command line -all:all= to delete all metadata information
5. Add new date XMP in the PDF to get original date and time

Please let me know whether above followed process is correct or is there any better way to do the same.

Regards,
Umesh Vishwakarma

Phil Harvey

OK then.  The 5 steps you described can be achieved with this exiftool command:

exiftool -all= -tagsfromfile @ -xmp:createdate -xmp:modifydate -xmp:creatortool=Elsevier FILE

But you should read the notes in the PDF tags documentation to understand the implications of the incremental update technique that ExifTool uses.

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

uvishwakarma