ISO (International Organization for Standardization) has maintained an open source for Portable Document Format or PDF as it is a widely used file format. One speciality is that you can exchange the PDF documents independent of software, hardware and operating systems being used. The general information about a PDF file is called its Metadata and we can inspect and edit it. This article is all about How to View or Edit PDF/Image Metadata from Command Line on Linux.
How to View or Edit PDF/Image Metadata from Command Line
You can view or edit the Metadata of your PDF and image file using the below mentioned methods:
How to View the Metadata of a PDF File Using exiftool Command
Step 1: You can install exiftool on your Linux system by executing the command mentioned below:
Step 2: Now you can view the metadata of any PDF file using the command format given below:
For demonstration I have executed the command for file name example using the above format:
You can also use the command format given below to know the specific data of a PDF file:
For demonstration I have executed the command for file name example using the above format to know the name of creator of the file:
How to View the Metadata of a PDF File Using pdfinfo Command
You can view the metadata of a PDF file on Linux by using the command pdfinfo following the syntax given below:
Now to view the metadata of file name example using pdfinfo command execute the command mentioned below:
How to View the Metadata of a PDF File Using file Command
You can view the metadata of a PDF file on Linux by using the command file following the syntax given below:
Now to view the metadata of file name example using file command execute the command mentioned below:
How to Edit PDF Metadata Using exiftool Command
You can edit the metadata of any PDF file using the syntax given below which is used to edit the name of the file creator:
For example, you if want to edit the name of the creator of the file you can execute the command given below using the above syntax:
You can clear the metadata for a field by overwriting it with empty data, using the given below syntax.
For example, you can clear the metadata of file example by running the command given below:
You can also clear the metadata for all fields in the PDF file, using the given below syntax:
For example, you can clear the metadata of file example by running the command given below:
You can see there is a file named example in the Documents folder:
You can change the title of the file executing the command format given below:
For example, you can change the title of file example by running the command given below:
In the above image you can see the file has been updated and you can see the title of the pdf file.
How to View Image Metadata using exiftool
You can also use the exiftool to View or Edit the Metadata of an image file. Follow the syntax given below to view the metadata of an image file:
To demonstrate I have used the image named as Index to view its metadata using exiftool following the syntax of command given above:
How to Edit Image Metadata using exiftool
You can edit the tags of the image using the format given below:
For example, i changed the artist’s name of the image index using the command mentioned below:
You can see the changed tag using the command given above for showing all the metadata of the image above. Similarity you can modify the all the parameters of the metadata of an image using the following syntax:
Conclusion
This article provides you the proper guide on how you can view and edit the metadata of an image or pdf file using different command line tools. One of the best tools is exiftool as it provides you with the function of viewing as well as editing the metadata of a pdf file. Further you can use file and pdfinfo commands to view the metadata of files by using the guide mentioned above in the article.