5

There is already an application that does this, pdftk (see also How to preserve bookmarks when rearranging pages of a PDF file with tools like pdftk? - Unix & Linux Stack Exchange):

pdftk in.pdf dump_data output in.info verbose     # dump all metadata to file in.info
pdftk in2.pdf update_info in.info output out.pdf  # write all metadata from file in.info into in2.pdf, generating out.pdf

However, I just got into a situation where pdftk cannot open my 40+ MB PDF file (which can be opened by evince or acroread or other tools), and so I'd like to ask here for alternatives: are there any other command line tools that work in Linux that can do the same as above?

(I suspect exiftool might, but its help is too hard for me to read; and I can see it can read/write individual tags - but not how to dump and update all defined metadata tags at once, like the above pdftk example does).

1 Answer 1

2

Well, apparently exiftool can do something like this:

exiftool Application Documentation

exiftool -TagsFromFile src.jpg '-xmp:all<all' dst.jpg

Copy all possible information from src.jpg and write in XMP format to dst.jpg.

... and from my limited tests, this does work for PDF files, as in:

exiftool -TagsFromFile src.pdf '-xmp:all<all' dst.pdf

... but this "applies" tags directly from one file to another - it doesn't export to and import from an intermediary text file. If I figure sometime how to do that, I'll update this answer.

Finally, for PDF, note this, which is stated in the same exiftool Application Documentation link above:

3) Changes to PDF files are reversible because the original information is never actually deleted from the file. So ExifTool alone may not be used to securely edit metadata in PDF files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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