I have many files of music; with the program mp3Tag, I had organized all of it. I have the correct metadata as it allows. I am looking for a free software that does the same, but for PDF files.

  • 1
  • Please modify your question title. You are NOT interested in the internals of PDF format, it seems, but rather in the names of free s/w which might help you modify pdf metadata. I'm not even sure if it's linux related at all, from the way this question is worded. – Dani_l Dec 23 '18 at 20:29
  • I am Latin, sorry for bad sense fo question. I am in Win10, but I want to know that's too. Win10 shows many columns with Author, Year, and I thinks is for PDf and relationed. – Jaaziel Aguirre Dec 29 '18 at 4:11

pdftk is a command line utility allowing you to extract and modify the PDFs metadata using the dump_data and the update_info options.

The following command will extract the metadata of the input.pdf to metadata file:

pdftk input.pdf dump_data output metadata

Modify the content of the metadata file using your text editor, then update the pdf file to a new output.pdf:

pdftk input.pdf update_info metadata output output.pdf

To check the new pdf file (print to stdout):

pdftk output.pdf dump_data
  • 1
    Ha!, I was thinking about adding pdftk's method a little bit later too. Now I can upvote your answer instead... :-) – Kurt Pfeifle Dec 22 '18 at 20:13
  • Hey, that's is simple. thanks for response. My ask was for Win10 but it helps me for the future, I had problems with Computers and just now I have a Pc with only win10. thanks – Jaaziel Aguirre Dec 29 '18 at 4:05

Ghostscript can insert or modify document metadata into any PDF.

Caveats: While doing so, Ghostscript will (1) first read in the complete PDF code, (2) second re-process that complete PDF code, (3) write out a completely new PDF file. This process can be wanted (could be for the advantage of the PDF quality, for example by additionally embedding previously missing fonts) or unwanted...

How to do it

  1. Create a text file named mydocinfo.pdfmark and put the following content into it:

    [ /Title (Jaziel's Important Document)
      /Author (Jaziel Aguirre)
      /Subject (Mr. Aguirre's experiments with pdfmark)
      /Creator (JA's Metadata Inserter)
      /ModDate (D:19700101000000+01'00')
      /Producer (A 'pdfmark' trick with Ghostscript)
      /Keywords (Metadata, Ghostscript, PDF, Linux)
      /CreationDate (D:20181229104653+01'00')

    Note, that the opening [ does NOT require a closing ] -- it is closed by the 'pdfmark' keyword.

  2. Now run this Ghostscript command to insert the new metadata into an existing PDF:

    gs                     \
      -o with-metadata.pdf \
      -sDEVICE=pdfwrite    \
      existing.pdf         \
  3. Check the new metadata:

    pdfinfo with-metadata.pdf
      Title:          Jaziel's Important Document
      Subject:        Mr. Aguirre's experiments with pdfmark
      Keywords:       Metadata, Ghostscript, PDF, Linux
      Author:         Jaziel Aguirre
      Creator:        JA's Metadata Inserter
      Producer:       A 'pdfmark' trick with Ghostscript
      CreationDate:   Sat Dec 29 10:46:53 2018 CET
      ModDate:        Thu Jan  1 00:00:00 1970 CET
      Tagged:         no
      UserProperties: no
      Suspects:       no
      Form:           none
      JavaScript:     no
      Pages:          1
      Encrypted:      no
      Page size:      142.8 x 202.08 pts
      Page rot:       0
      File size:      5394 bytes
      Optimized:      no
      PDF version:    1.7

(Tested with Ghostscript v9.27.)

  • what a useful, I will do this in some future. thanks – Jaaziel Aguirre Dec 29 '18 at 4:07
  • @JaazielAguirre: So my answer is deserving a positive comment, but not deserving a simple upvote? – Kurt Pfeifle Dec 29 '18 at 9:22
  • Mmm Yes, but i am new here, so, I click the up arrow of corner? – Jaaziel Aguirre Dec 30 '18 at 21:03
  • @JaazielAguirre: Exactly. Plus, you pick one (or none) of the answers to make it the "accepted" (best) answer for you... – Kurt Pfeifle Dec 30 '18 at 22:28

Instead of writing the metadata into a text file first, you could of course also put it into one single command line:

gs -o with-meta.pdf -sDEVICE=pdfwrite -f existing.pdf -c "[ /Title (Jaziel's Important Document) /Author (Jaziel Aguirre) /Subject (Mr. Aguirre's experiments with pdfmark) /ModDate (D:19700101000000+01'00') /CreationDate (D:20181120102653+01'00') /Keywords (Metadata, Ghostscript, PDF, Linux) /Creator (JA's Metadata Inserter) /Producer (A 'pdfmark' trick with Ghostscript) /DOCINFO pdfmark"

or, with a formatting which is a bit more nice (readable):

gs -o with-meta.pdf  \
   -sDEVICE=pdfwrite \
   -f existing.pdf   \
   -c "[ /Title (Jaziel's Important Document) 
         /Author (Jaziel Aguirre)
         /Subject (Mr. Aguirre's experiments with pdfmark)
         /Keywords (Metadata, Ghostscript, PDF, Linux)
         /ModDate (D:19700101000000+01'00')
         /Keywords (Metadata, Ghostscript, PDF, Linux)
         /Creator (JA's Metadata Inserter)
         /Producer (A 'pdfmark' trick with Ghostscript)
         /CreationDate (D:20181120102653+01'00')
       /DOCINFO pdfmark"

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.