12

There is a program provided by Apple to see most of the metadata in a file. It is nice to have the metadata clearly arranged, but the catch is that you cannot delete it or I don't know how to delete it.

For example, there is a PDF file in front of me that contains the source, the author and my operating system version. I would like to change this. I tried to delete the source using xattr -c

It seems as if the information is in the file and not added attributes are from the system itself ...

Does anyone know how to delete or change the metadata on PDF files?

1
  • The solution provided by @benwiggy worked perfectly for me. I was trying to remove metadata like 1. Content Creator: 2. Encoding software: 3. Where from: and it removed them all. Commented Aug 8, 2022 at 22:48

3 Answers 3

16

Meta information and attributes is complex thing and I am not qualified to cover it extensively. Nevertheless. Distinction should be made between:

  • meta information in files (usually displayed in GUI like Finder)
  • Extended File Attributes

It is my understanding that question is about meta information one can see using ⌘ + i in Finder and xattr is not suited for that (it's for Extended File Attributes).

If you remove extended attributes with xattr -c my_file.pdf it may seem that all attributes are removed (xattr my_file.pdf returns nothing). However, Finder displays meta information in tact.

Built-in mdls lists the metadata attributes for the specified file. The problem with mdls is that attributes are in MacOS plist format which not match names of attributes one can see in Finder using ⌘ + i. Additionally it also displays mixed selection of meta information and extended file attributes as well as fact it allows listing but not editing.

For deleting pdf meta information one can use exiftool and/or qpdf (both are not built in).

To remove all meta information in my_file.pdf using exiftool:

exiftool -all= my_file.pdf

It removes meta information, but displays warning:

Warning: [minor] ExifTool PDF edits are reversible. Deleted tags may be recovered! - my_file.pdf
    1 image files updated

Pending ones needs linearizing this file with qpdf to remove artifacts (creates new file) might be an option:

qpdf --linearize my_file.pdf my_new_file.pdf

...and then one can read something like Cleaning PDF metadata in depth and realize that nothing is certain except taxes and death.

1
  • 2
    exiftool worked like a charm! Thanks!
    – thomax
    Commented May 26, 2021 at 15:39
11

You can look at ExifCleaner ... despite the name, it also cleans non-EXIF metadata, e.g., from PDF files.

Description from documenation:

Desktop app to clean metadata from images, videos, PDFs, and other files.

Supports:

  • Windows, Mac, and Linux
  • Image formats such as PNG, JPG, GIF, and TIFF
  • Video formats such as M4A, MOV, and MP4
  • PDF documents (partial)
  • Batch-processing

Installation:

# see https://exifcleaner.com/ for other installation options
# see https://github.com/szTheory/exifcleaner#readme for Github repo
brew install exifcleaner

Usage:

Easy. Drop files into application window. It will tell you which specific attributes were cleaned. ExifCleaner screenshot

0
5

There is macOS file system metadata, and then there is PDF metadata. The PDF file format itself contains metadata for the Title, Creator, Author, encoding software used, creation Date and more. This is separate from the data that macOS can append to a file on its disks.

Various third-party apps, like Acrobat, PDFPen Pro, etc, provide dialogs to edit this data. You can also modify it with Automator.

You'd need to create a workflow that takes a PDF as input, and then changes the metadata to something else, which could be " ".

enter image description here

Note that it doesn't contain 'your OS', but the version of MacOS that made the PDF.

Note that you can't change the Encoding Software value.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .