To elaborate on the pdftk
editing method, which is nice because it shows you everything that's being set, at the same time as allowing you to change anything you like, here is a script (for your .bashrc
or other aliases file) to do it with one command. This creates a new version of the file you want to edit, opens your favourite editor with the metadatafile, and then implements your changes and sets the file creation/modification time on the modified PDF file to be the same as the original. To use it, after resourcing your .bashrc
file, just type
editPDFmetadata myfile.pdf
Here's the alias:
editPDFmetadata() {
OUTPUT="${1}-new.pdf"
METADATA="tmp${1}-report.txt"
pdftk ${1} dump_data output $METADATA
$EDITOR $METADATA
pdftk ${1} update_info $METADATA output $OUTPUT
touch -r ${1} ${OUTPUT}
}
Simply place the definition above into the .bashrc
file in your home folder, then open a new terminal and it will be ready to use.