PDF Metadata generally contains information about the PDF document – such as Title, Author, MIME type, creator, keyword, pdf version, etc. This information is embedded into the PDF document itself and read by the applications including WordPress and search engines. For instance, I uploaded a PDF document to WordPress media and saw the title of the PDF file to be different than what I wanted. This is due to the title information stored in the PDF metadata and WordPress simply used that for the title of the PDF file. But what if you want to change that? Well, you can quickly read or change PDF metadata from the Linux command line using a simple utility called – ExifTool.
Change PDF Metadata from the Linux command line
ExifTool is a simple command utility that allows you to read and change PDF metadata. Follow the below steps to use ExifTool.
Step 1: Install ExifTool on Linux
On Ubuntu, Debian, and Linux Mint:
$ sudo apt install libimage-exiftool-perl
On Fedora, CentOs and RedHat Linux:
$ sudo dnf install perl-Image-ExifTool
$ yum install perl-Image-ExifTool
Step 2: Read the metadata from the PDF file
# exiftool sample.pdf ExifTool Version Number : 12.60 File Name : sample.pdf Directory : . File Size : 13 MB File Modification Date/Time : 2023:09:27 17:41:04+05:30 File Access Date/Time : 2023:09:27 17:41:04+05:30 File Inode Change Date/Time : 2023:09:27 17:41:04+05:30 File Permissions : -rw-r--r-- File Type : PDF File Type Extension : pdf MIME Type : application/pdf Linearized : No PDF Version : 1.4 Page Count : 25 Tagged PDF : Yes Language : en XMP Toolkit : Image::ExifTool 12.60 Author : David Peter Creator : AI Producer : AI Create Date : 2023:09:21 11:26:38+00:00 Modify Date : 2023:09:21 11:26:35+00:00 Keywords : DAFtM1J7lWc, BACgE39lmK8 Title : 1.Sample - May Edition 2023
To read or display specific metadata, say Author, then run the below command.
$ exiftool -Author sample.pdf Author : David Peter
Step 3: Change metadata from the PDF file
In order to change the Author of the PDF file, execute the below command.
# exiftool -Author="Ramya Santhosh" sample.pdf
To change the Title of the PDF.
# exiftool -Title="Techglimpse Magazine May 2023" sample.pdf
To clear or remove all the metadata from the PDF file:
$ exiftool -all=sample.pdf
Read the manpage of the utility for more options.
Note: ExifTool, is basically a Perl library that helps to read, write, and edit meta information in a variety of file formats – EXIF, GPS, XMP, JFIF, GeoTIFF, FLashPix etc. You may find more information on the official website.
You also like the GUI version of ExifTool. Just download the GUI tool from here and install it. Please note that the ExifToolGUI does not write anything into the system registry and instead stores the settings in the ExifToolGUI.ini file.
Also read: Merge various file formats into a single PDF.