How to edit pdf metadata from command line? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How to change pdf title in Kubuntu?How to rename a file title?Command line tool to crop PDF filesHow to outline fonts in a PDF (or eps) file?Simple Scan: PDF does not open on Android (Adobe reader) (dated 1970!)Zotero cannot retrieve metadata from PDFLibreOffice command line font substitution at pptx to pdf conversionIs ther any tool in ubuntu to convert pdf to docConvert pdf to monochrome black-and-white via command lineApp for deleting PDF metadata?How to print PDF or Postscript files to printer directly from the command lineDeleting PDF pages based on the format

Do working physicists consider Newtonian mechanics to be "falsified"?

What aspect of planet Earth must be changed to prevent the industrial revolution?

different output for groups and groups USERNAME after adding a username to a group

Is 'stolen' appropriate word?

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

Could an empire control the whole planet with today's comunication methods?

Can the DM override racial traits?

Identify 80s or 90s comics with ripped creatures (not dwarves)

Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time?

Sub-subscripts in strings cause different spacings than subscripts

Is this wall load bearing? Blueprints and photos attached

Accepted by European university, rejected by all American ones I applied to? Possible reasons?

60's-70's movie: home appliances revolting against the owners

What force causes entropy to increase?

Are there continuous functions who are the same in an interval but differ in at least one other point?

What is the padding with red substance inside of steak packaging?

Am I ethically obligated to go into work on an off day if the reason is sudden?

Can a flute soloist sit?

Student Loan from years ago pops up and is taking my salary

Make it rain characters

Keeping a retro style to sci-fi spaceships?

How to read αἱμύλιος or when to aspirate

Single author papers against my advisor's will?

How do you keep chess fun when your opponent constantly beats you?



How to edit pdf metadata from command line?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How to change pdf title in Kubuntu?How to rename a file title?Command line tool to crop PDF filesHow to outline fonts in a PDF (or eps) file?Simple Scan: PDF does not open on Android (Adobe reader) (dated 1970!)Zotero cannot retrieve metadata from PDFLibreOffice command line font substitution at pptx to pdf conversionIs ther any tool in ubuntu to convert pdf to docConvert pdf to monochrome black-and-white via command lineApp for deleting PDF metadata?How to print PDF or Postscript files to printer directly from the command lineDeleting PDF pages based on the format



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








74















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






























    74















    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


























      74












      74








      74


      37






      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
















      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?







      command-line pdf metadata






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 22 '11 at 6:53







      bdr529

















      asked Feb 21 '11 at 11:40









      bdr529bdr529

      1,69811214




      1,69811214




















          4 Answers
          4






          active

          oldest

          votes


















          91














          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


















          • 15





            Note that: "All metadata edits are reversible. While this would normally be considered an advantage, it is a potential security problem because old information is never actually deleted from the file."

            – nutty about natty
            Aug 12 '14 at 7:11







          • 5





            @nuttyaboutnatty if you want to purge all remnant and unused metadata entries, you can linearize the PDF file right after processing it with exiftool. This is described in more detail in this Github gist.

            – Glutanimate
            Aug 13 '14 at 23:41







          • 8





            @nuttyaboutnatty Well, of course it's not an authoritative source but that's only because nobody ever took the time to write one. However, I can assure that the method described by the author works. Try it out yourself: 1.) Take a PDF that has some tags and "delete" all metadata with exiftool -overwrite_original -all:all="" file.pdf; 2.) Use exiftool -PDF-update:all= file.pdf to confirm that there is still old metadata present; 3.) linearize the file with qpdf --linearize file.pdf; 4.) Check again, like you did in 2.); all metadata should be gone;

            – Glutanimate
            Aug 14 '14 at 7:54







          • 3





            5.) confirm that the file has been purged of all metadata by looking at the PDF dictionary (pdfinfo -meta file.pdf)

            – Glutanimate
            Aug 14 '14 at 7:55






          • 1





            Works perfectly. I regularly want to copy the metadata from one PDF to another, in which case exiftool -overwrite_original -tagsFromFile <srcfile> <destfile> is what I need (the option -overwrite_original overwrites the original <destfile>).

            – AstroFloyd
            Apr 22 '18 at 15:57


















          14














          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






          • 1





            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







          • 2





            to use pdftk, what you need to do is: 1) pdftk book.pdf dump_data output report.txt 2) edit report.txt 3) pdftk book.pdf update_info report.txt output bookcopy.pdf

            – craq
            Oct 24 '17 at 3:02


















          6














          Using Ghostview



          Create a file named “pdfmarks” with this content:



          [ /Title (Document title)
          /Author (Author name)
          /Subject (Subject description)
          /Keywords (comma, separated, keywords)
          /ModDate (D:20061204092842)
          /CreationDate (D:20061204092842)
          /Creator (application name or creator note)
          /Producer (PDF producer name or note)
          /DOCINFO pdfmark


          then combine this pdfmarks file with a PDF, PS or EPS input file:



          gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf no_marks.pdf pdfmarks


          Source: http://milan.kupcevic.net/ghostscript-ps-pdf/






          share|improve this answer






























            0














            To elaborate on the pdftk 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.






            share|improve this answer























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "89"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f27381%2fhow-to-edit-pdf-metadata-from-command-line%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              91














              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


















              • 15





                Note that: "All metadata edits are reversible. While this would normally be considered an advantage, it is a potential security problem because old information is never actually deleted from the file."

                – nutty about natty
                Aug 12 '14 at 7:11







              • 5





                @nuttyaboutnatty if you want to purge all remnant and unused metadata entries, you can linearize the PDF file right after processing it with exiftool. This is described in more detail in this Github gist.

                – Glutanimate
                Aug 13 '14 at 23:41







              • 8





                @nuttyaboutnatty Well, of course it's not an authoritative source but that's only because nobody ever took the time to write one. However, I can assure that the method described by the author works. Try it out yourself: 1.) Take a PDF that has some tags and "delete" all metadata with exiftool -overwrite_original -all:all="" file.pdf; 2.) Use exiftool -PDF-update:all= file.pdf to confirm that there is still old metadata present; 3.) linearize the file with qpdf --linearize file.pdf; 4.) Check again, like you did in 2.); all metadata should be gone;

                – Glutanimate
                Aug 14 '14 at 7:54







              • 3





                5.) confirm that the file has been purged of all metadata by looking at the PDF dictionary (pdfinfo -meta file.pdf)

                – Glutanimate
                Aug 14 '14 at 7:55






              • 1





                Works perfectly. I regularly want to copy the metadata from one PDF to another, in which case exiftool -overwrite_original -tagsFromFile <srcfile> <destfile> is what I need (the option -overwrite_original overwrites the original <destfile>).

                – AstroFloyd
                Apr 22 '18 at 15:57















              91














              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


















              • 15





                Note that: "All metadata edits are reversible. While this would normally be considered an advantage, it is a potential security problem because old information is never actually deleted from the file."

                – nutty about natty
                Aug 12 '14 at 7:11







              • 5





                @nuttyaboutnatty if you want to purge all remnant and unused metadata entries, you can linearize the PDF file right after processing it with exiftool. This is described in more detail in this Github gist.

                – Glutanimate
                Aug 13 '14 at 23:41







              • 8





                @nuttyaboutnatty Well, of course it's not an authoritative source but that's only because nobody ever took the time to write one. However, I can assure that the method described by the author works. Try it out yourself: 1.) Take a PDF that has some tags and "delete" all metadata with exiftool -overwrite_original -all:all="" file.pdf; 2.) Use exiftool -PDF-update:all= file.pdf to confirm that there is still old metadata present; 3.) linearize the file with qpdf --linearize file.pdf; 4.) Check again, like you did in 2.); all metadata should be gone;

                – Glutanimate
                Aug 14 '14 at 7:54







              • 3





                5.) confirm that the file has been purged of all metadata by looking at the PDF dictionary (pdfinfo -meta file.pdf)

                – Glutanimate
                Aug 14 '14 at 7:55






              • 1





                Works perfectly. I regularly want to copy the metadata from one PDF to another, in which case exiftool -overwrite_original -tagsFromFile <srcfile> <destfile> is what I need (the option -overwrite_original overwrites the original <destfile>).

                – AstroFloyd
                Apr 22 '18 at 15:57













              91












              91








              91







              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













              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












              share|improve this answer



              share|improve this answer










              answered May 4 '11 at 5:08









              SabaconSabacon

              26.5k42839




              26.5k42839







              • 15





                Note that: "All metadata edits are reversible. While this would normally be considered an advantage, it is a potential security problem because old information is never actually deleted from the file."

                – nutty about natty
                Aug 12 '14 at 7:11







              • 5





                @nuttyaboutnatty if you want to purge all remnant and unused metadata entries, you can linearize the PDF file right after processing it with exiftool. This is described in more detail in this Github gist.

                – Glutanimate
                Aug 13 '14 at 23:41







              • 8





                @nuttyaboutnatty Well, of course it's not an authoritative source but that's only because nobody ever took the time to write one. However, I can assure that the method described by the author works. Try it out yourself: 1.) Take a PDF that has some tags and "delete" all metadata with exiftool -overwrite_original -all:all="" file.pdf; 2.) Use exiftool -PDF-update:all= file.pdf to confirm that there is still old metadata present; 3.) linearize the file with qpdf --linearize file.pdf; 4.) Check again, like you did in 2.); all metadata should be gone;

                – Glutanimate
                Aug 14 '14 at 7:54







              • 3





                5.) confirm that the file has been purged of all metadata by looking at the PDF dictionary (pdfinfo -meta file.pdf)

                – Glutanimate
                Aug 14 '14 at 7:55






              • 1





                Works perfectly. I regularly want to copy the metadata from one PDF to another, in which case exiftool -overwrite_original -tagsFromFile <srcfile> <destfile> is what I need (the option -overwrite_original overwrites the original <destfile>).

                – AstroFloyd
                Apr 22 '18 at 15:57












              • 15





                Note that: "All metadata edits are reversible. While this would normally be considered an advantage, it is a potential security problem because old information is never actually deleted from the file."

                – nutty about natty
                Aug 12 '14 at 7:11







              • 5





                @nuttyaboutnatty if you want to purge all remnant and unused metadata entries, you can linearize the PDF file right after processing it with exiftool. This is described in more detail in this Github gist.

                – Glutanimate
                Aug 13 '14 at 23:41







              • 8





                @nuttyaboutnatty Well, of course it's not an authoritative source but that's only because nobody ever took the time to write one. However, I can assure that the method described by the author works. Try it out yourself: 1.) Take a PDF that has some tags and "delete" all metadata with exiftool -overwrite_original -all:all="" file.pdf; 2.) Use exiftool -PDF-update:all= file.pdf to confirm that there is still old metadata present; 3.) linearize the file with qpdf --linearize file.pdf; 4.) Check again, like you did in 2.); all metadata should be gone;

                – Glutanimate
                Aug 14 '14 at 7:54







              • 3





                5.) confirm that the file has been purged of all metadata by looking at the PDF dictionary (pdfinfo -meta file.pdf)

                – Glutanimate
                Aug 14 '14 at 7:55






              • 1





                Works perfectly. I regularly want to copy the metadata from one PDF to another, in which case exiftool -overwrite_original -tagsFromFile <srcfile> <destfile> is what I need (the option -overwrite_original overwrites the original <destfile>).

                – AstroFloyd
                Apr 22 '18 at 15:57







              15




              15





              Note that: "All metadata edits are reversible. While this would normally be considered an advantage, it is a potential security problem because old information is never actually deleted from the file."

              – nutty about natty
              Aug 12 '14 at 7:11






              Note that: "All metadata edits are reversible. While this would normally be considered an advantage, it is a potential security problem because old information is never actually deleted from the file."

              – nutty about natty
              Aug 12 '14 at 7:11





              5




              5





              @nuttyaboutnatty if you want to purge all remnant and unused metadata entries, you can linearize the PDF file right after processing it with exiftool. This is described in more detail in this Github gist.

              – Glutanimate
              Aug 13 '14 at 23:41






              @nuttyaboutnatty if you want to purge all remnant and unused metadata entries, you can linearize the PDF file right after processing it with exiftool. This is described in more detail in this Github gist.

              – Glutanimate
              Aug 13 '14 at 23:41





              8




              8





              @nuttyaboutnatty Well, of course it's not an authoritative source but that's only because nobody ever took the time to write one. However, I can assure that the method described by the author works. Try it out yourself: 1.) Take a PDF that has some tags and "delete" all metadata with exiftool -overwrite_original -all:all="" file.pdf; 2.) Use exiftool -PDF-update:all= file.pdf to confirm that there is still old metadata present; 3.) linearize the file with qpdf --linearize file.pdf; 4.) Check again, like you did in 2.); all metadata should be gone;

              – Glutanimate
              Aug 14 '14 at 7:54






              @nuttyaboutnatty Well, of course it's not an authoritative source but that's only because nobody ever took the time to write one. However, I can assure that the method described by the author works. Try it out yourself: 1.) Take a PDF that has some tags and "delete" all metadata with exiftool -overwrite_original -all:all="" file.pdf; 2.) Use exiftool -PDF-update:all= file.pdf to confirm that there is still old metadata present; 3.) linearize the file with qpdf --linearize file.pdf; 4.) Check again, like you did in 2.); all metadata should be gone;

              – Glutanimate
              Aug 14 '14 at 7:54





              3




              3





              5.) confirm that the file has been purged of all metadata by looking at the PDF dictionary (pdfinfo -meta file.pdf)

              – Glutanimate
              Aug 14 '14 at 7:55





              5.) confirm that the file has been purged of all metadata by looking at the PDF dictionary (pdfinfo -meta file.pdf)

              – Glutanimate
              Aug 14 '14 at 7:55




              1




              1





              Works perfectly. I regularly want to copy the metadata from one PDF to another, in which case exiftool -overwrite_original -tagsFromFile <srcfile> <destfile> is what I need (the option -overwrite_original overwrites the original <destfile>).

              – AstroFloyd
              Apr 22 '18 at 15:57





              Works perfectly. I regularly want to copy the metadata from one PDF to another, in which case exiftool -overwrite_original -tagsFromFile <srcfile> <destfile> is what I need (the option -overwrite_original overwrites the original <destfile>).

              – AstroFloyd
              Apr 22 '18 at 15:57













              14














              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






              • 1





                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







              • 2





                to use pdftk, what you need to do is: 1) pdftk book.pdf dump_data output report.txt 2) edit report.txt 3) pdftk book.pdf update_info report.txt output bookcopy.pdf

                – craq
                Oct 24 '17 at 3:02















              14














              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






              • 1





                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







              • 2





                to use pdftk, what you need to do is: 1) pdftk book.pdf dump_data output report.txt 2) edit report.txt 3) pdftk book.pdf update_info report.txt output bookcopy.pdf

                – craq
                Oct 24 '17 at 3:02













              14












              14








              14







              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













              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












              share|improve this answer



              share|improve this answer










              answered Feb 21 '11 at 11:44









              OlliOlli

              7,03713040




              7,03713040







              • 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






              • 1





                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







              • 2





                to use pdftk, what you need to do is: 1) pdftk book.pdf dump_data output report.txt 2) edit report.txt 3) pdftk book.pdf update_info report.txt output bookcopy.pdf

                – craq
                Oct 24 '17 at 3:02












              • 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






              • 1





                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







              • 2





                to use pdftk, what you need to do is: 1) pdftk book.pdf dump_data output report.txt 2) edit report.txt 3) pdftk book.pdf update_info report.txt output bookcopy.pdf

                – craq
                Oct 24 '17 at 3:02







              1




              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





              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





              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





              pdftk seems to Unicode characters in the metadata.

              – Mechanical snail
              Apr 21 '13 at 21:06




              1




              1





              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






              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





              2




              2





              to use pdftk, what you need to do is: 1) pdftk book.pdf dump_data output report.txt 2) edit report.txt 3) pdftk book.pdf update_info report.txt output bookcopy.pdf

              – craq
              Oct 24 '17 at 3:02





              to use pdftk, what you need to do is: 1) pdftk book.pdf dump_data output report.txt 2) edit report.txt 3) pdftk book.pdf update_info report.txt output bookcopy.pdf

              – craq
              Oct 24 '17 at 3:02











              6














              Using Ghostview



              Create a file named “pdfmarks” with this content:



              [ /Title (Document title)
              /Author (Author name)
              /Subject (Subject description)
              /Keywords (comma, separated, keywords)
              /ModDate (D:20061204092842)
              /CreationDate (D:20061204092842)
              /Creator (application name or creator note)
              /Producer (PDF producer name or note)
              /DOCINFO pdfmark


              then combine this pdfmarks file with a PDF, PS or EPS input file:



              gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf no_marks.pdf pdfmarks


              Source: http://milan.kupcevic.net/ghostscript-ps-pdf/






              share|improve this answer



























                6














                Using Ghostview



                Create a file named “pdfmarks” with this content:



                [ /Title (Document title)
                /Author (Author name)
                /Subject (Subject description)
                /Keywords (comma, separated, keywords)
                /ModDate (D:20061204092842)
                /CreationDate (D:20061204092842)
                /Creator (application name or creator note)
                /Producer (PDF producer name or note)
                /DOCINFO pdfmark


                then combine this pdfmarks file with a PDF, PS or EPS input file:



                gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf no_marks.pdf pdfmarks


                Source: http://milan.kupcevic.net/ghostscript-ps-pdf/






                share|improve this answer

























                  6












                  6








                  6







                  Using Ghostview



                  Create a file named “pdfmarks” with this content:



                  [ /Title (Document title)
                  /Author (Author name)
                  /Subject (Subject description)
                  /Keywords (comma, separated, keywords)
                  /ModDate (D:20061204092842)
                  /CreationDate (D:20061204092842)
                  /Creator (application name or creator note)
                  /Producer (PDF producer name or note)
                  /DOCINFO pdfmark


                  then combine this pdfmarks file with a PDF, PS or EPS input file:



                  gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf no_marks.pdf pdfmarks


                  Source: http://milan.kupcevic.net/ghostscript-ps-pdf/






                  share|improve this answer













                  Using Ghostview



                  Create a file named “pdfmarks” with this content:



                  [ /Title (Document title)
                  /Author (Author name)
                  /Subject (Subject description)
                  /Keywords (comma, separated, keywords)
                  /ModDate (D:20061204092842)
                  /CreationDate (D:20061204092842)
                  /Creator (application name or creator note)
                  /Producer (PDF producer name or note)
                  /DOCINFO pdfmark


                  then combine this pdfmarks file with a PDF, PS or EPS input file:



                  gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf no_marks.pdf pdfmarks


                  Source: http://milan.kupcevic.net/ghostscript-ps-pdf/







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 19 '16 at 18:54









                  Serge StroobandtSerge Stroobandt

                  2,2412034




                  2,2412034





















                      0














                      To elaborate on the pdftk 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.






                      share|improve this answer



























                        0














                        To elaborate on the pdftk 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.






                        share|improve this answer

























                          0












                          0








                          0







                          To elaborate on the pdftk 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.






                          share|improve this answer













                          To elaborate on the pdftk 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.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered May 17 '18 at 17:40









                          CPBLCPBL

                          308510




                          308510



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f27381%2fhow-to-edit-pdf-metadata-from-command-line%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Tamil (spriik) Luke uk diar | Nawigatjuun

                              Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                              Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?