changing the title, metadata and other properties of a password protected pdf
i bought an ebook reader (sony prs-t1 [which i rooted following this instructions]) and wanted to add all manuals of my household to it … so i could look up any setting quickly … so i downloaded the manual for my stereo system “TEAC TC-X350i” (from TEAC) and uploaded it to my ebook reader …
i had the idea that all manuals appear in the order %MANUFACTURER% %MODEL% …
i was confused that the manual on the ebook reader had the title “TC-X350I_OM_EF_…” and first thought of it beeing the filename .. but was wrong there … it turned out that this was some pdf-title …
i could not edit the manual as it was password protected … so i found the following solution to edit the pdf-title (and add other pdf properties):
run the following command to “print” a pdf named “temp.pdf” from the orginal pdf (named “original.pdf”) using ghostscript …
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=temp.pdf -c .setpdfwrite -f original.pdf
install pdftk if you don’t have it installed:
sudo apt-get install pdftk
now run the follwing command to get a file (named “result.txt” containing all the pdf-properties aka metadata) …
pdftk temp.pdf dump_data output report.txt
open it in gedit or any other text editor and edit the line after “InfoKey: Title” (right after “InfoValue: “) … the following image shows my edited “result.txt” (i also added the author “TEAC” and a subject “Manual”) …
you then have to merge the new properties/metadata (the “result.txt”) to the “temp.pdf” using the following command which results in a new pdf “ebook_with_new_properties.pdf”:
pdftk temp.pdf update_info report.txt output ebook_with_new_properties.pdf
… that’s it .. you may delete the file “original.pdf” and “temp.pdf” now and use “ebook_with_new_properties.pdf” …