Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need a command line tool for editing metadata of pdf-files.

I'm using a Aiptek MyNote Premium tablet for writing my notes and minutes on this device, import them later and convert them to pdf automatically with a simple script using inkscape and ghostscript.

Is there any command line tool to add some categories to the pdf's metadata, so i can find the pdf later (e.g. with gnome-do) by categories?

Update: I tried the solution with pdftk and it works, but it seems that gnome-do doesn't take care of pdf-metadata. Is there a way to get gnome-do to do that?

share|improve this question
add comment

2 Answers 2

up vote 16 down vote accepted

Give exiftool a try, it is available from the package libimage-exiftool-perl in the repositories.

As an example, If you have a pdf file called drawing.pdf and you want to update its metadata, Use the utility, exiftool, in this way:

exiftool -Title="This is the Title" -Author="Happy Man" -Subject="PDF Metadata" drawing.pdf

For some reason the Subject entered ends up in the keywords field of the metadata in the pdf file. not a problem in some cases, even desirable, however, this may be problematic, evince and the nautilus metadata previewer do not show this but Adobe Acrobat viewer and PDF-XChange viewer does.

The program will create a backup of the original file if you do not use the; -overwrite_original switch, this means a duplicate will exist in the folder where the updated pdf is. From example above; a file named ; drawing.pdf_original will be created.

use the overwrite switch at your own risk, my suggestion is not to use it and script something to move this file to a better location just in case.

share|improve this answer
    
This works fine, thank you. It's curious how much tools come along with ubuntu / linux. I wish to know more about all this stuff :-). Meanwhile i used pdfmod after importing my files. This is a nice little application. –  bdr529 May 4 '11 at 9:05
add comment

You can edit metadata by using pdftk. Check out update_info parameter. As for data file, below is an example:

InfoKey: Title
InfoValue: Mt-Djing: multitouch DJ table
InfoKey: Subject
InfoValue: Dissertation for Master degree
InfoKey: Keywords
InfoValue: DJing, NUI, multitouch, user-centered design
InfoKey: Author
InfoValue: Pedro Lopes

(Source)

share|improve this answer
1  
Ok, this means i have to export the metadata to a textfile, edit them and reimport the textfile. Is there a way to directly set a single metadata from command-line? –  bdr529 Feb 22 '11 at 6:48
    
There may be, but I couldn't find it. –  Olli Feb 22 '11 at 7:26
    
pdftk seems to Unicode characters in the metadata. –  Mechanical snail Apr 21 '13 at 21:06
    
I had some problem using pdftk on new pdfs (newer versions are encrypted via AESV2). Seems like it's discontinued. exiftool was working better. –  s1lv3r Aug 26 '13 at 14:58
    
@s1lv3r but exiftool isn't allowing for custom tags, isn't it? I have a problem where pdftk "hangs" on dump_data for a PDF, but after using exiftool on it, and adding 'author' thag, it works. I should get a pdf test program –  Jorge Apr 14 at 20:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.