Modifying PDF files

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
15
down vote

favorite
12












I would like to do some basic editing on existing PDF file. More specifically:



  • Add chapters/bookmarks

  • Change page numbering

However, I cannot find any tool, GUI or command line, which would offer this functionality. Is there any free-open alternative tools?










share|improve this question



























    up vote
    15
    down vote

    favorite
    12












    I would like to do some basic editing on existing PDF file. More specifically:



    • Add chapters/bookmarks

    • Change page numbering

    However, I cannot find any tool, GUI or command line, which would offer this functionality. Is there any free-open alternative tools?










    share|improve this question

























      up vote
      15
      down vote

      favorite
      12









      up vote
      15
      down vote

      favorite
      12






      12





      I would like to do some basic editing on existing PDF file. More specifically:



      • Add chapters/bookmarks

      • Change page numbering

      However, I cannot find any tool, GUI or command line, which would offer this functionality. Is there any free-open alternative tools?










      share|improve this question















      I would like to do some basic editing on existing PDF file. More specifically:



      • Add chapters/bookmarks

      • Change page numbering

      However, I cannot find any tool, GUI or command line, which would offer this functionality. Is there any free-open alternative tools?







      command-line software-rec editors gui pdf






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 25 at 17:44









      Goro

      6,42352863




      6,42352863










      asked Oct 21 '10 at 18:44









      Maciej Piechotka

      11k64276




      11k64276




















          5 Answers
          5






          active

          oldest

          votes

















          up vote
          18
          down vote



          accepted










          I use pdftk mainly. But here are some others to consider:



          pdfsam (PDF Split and Merge): "pdfsam is an open source tool (GPL license) designed to handle pdf files"



          PDFJam "A small collection of shell scripts which provide a simple interface to much of the functionality of the excellent pdfpages PDF file package (by Andreas Matthias) for pdfLaTeX." (You can also use pdfLaTeX directly.)



          jPDFTweak: "jPDF Tweak is a Java Swing application that can combine, split, rotate, reorder, watermark, encrypt, sign, and otherwise tweak PDF files."



          Inkscape: is a vector graphics editor that can both import PDF pages into its native SVG format, and also export as PDF.



          Calibre: Open source ebook management software that can convert PDFs to other formats, and manipulate them in other ways. Comes with command line tools such as pdfmanipulate which can be useful.



          Ghostscript of course can do a lot of things with PDF files too.






          share|improve this answer






















          • I use pdfjam but it seems none will do the 2 things I explicitly listed.
            – Maciej Piechotka
            Oct 21 '10 at 19:56






          • 1




            I misunderstood the question. Edit the question to make it clear what you meant by "chapters". I assumed you just wanted to insert one part of a PDF inside another. But perhaps you mean the pdf bookmarks (i.e., which appear in the side pane for some viewers)? PDFJam might not, but the pdfpages package for PDFLaTeX, along with the LaTeX hyperref package, can handle those. pdfedit should be able to change page numbers. With pdfLaTeX/pdfpages you could clip the bottom of the page and add new ones. BRISS can crop off headers/footers too, but you'd have to add them back with something else.
            – frabjous
            Oct 21 '10 at 20:18










          • Oh, and mbPDFasm can apparently also do stuff with bookmarks, but I've never used it: thierry.schmit.free.fr/spip/spip.php?article15&lang=en
            – frabjous
            Oct 21 '10 at 20:24






          • 2




            Another: jPDFBookmarks: flavianopetrocchi.blogspot.com/2009/03/…
            – frabjous
            Oct 21 '10 at 20:27

















          up vote
          12
          down vote













          I know two programs for manipulating PDFs under Linux:



          PDEedit "PDFedit is a free open source pdf editor and a library for manipulating PDF documents, released under terms of GNU GPL version 2. It includes PDF manipulating library based on xpdf, GUI, set of command line tools and a pdf editor."



          and
          pdftk "If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents."






          share|improve this answer






















          • pdfedit: I don't have qt3 and I cannot install it (not in portage) & I cannot get it to compile with qt4 (even with qt3support).
            – Maciej Piechotka
            Oct 21 '10 at 19:36

















          up vote
          5
          down vote













          The only way I found to add page numbers to a PDF was with LaTeX:



          Create a file /usr/local/bin/add-page-numbers.tex



          documentclass[8pt]article
          usepackage[final]pdfpages
          usepackagefancyhdr

          topmargin 70pt
          oddsidemargin 150pt

          pagestylefancy
          rfootLargethepage
          cfoot
          renewcommand headrulewidth0pt
          renewcommand footrulewidth0pt

          begindocument
          includepdfsetpagecommand=thispagestylefancy
          includepdf[pages=-]input.pdf
          enddocument


          And a file /usr/local/bin/pdf-numbers



          #!/bin/bash
          name="$1%.pdf-numbers"
          wd="$(pwd)"
          dir=/tmp/pdf-numbers
          mkdir -p "$dir"
          cp "$1" "$dir/input.pdf"
          cd "$dir"
          pdflatex --jobname "$name" /usr/local/bin/add-page-numbers.tex > /dev/null
          mv "$name.pdf" "$wd"
          rm -r "$dir"


          Make the latter file executable, and run it with



           pdf-numbers example.pdf


          It will create a pdf file called example-numbers.pdf (and overwrite it if it already exists!).






          share|improve this answer




















          • Working very well. Imperfection lies in absolute paths, but that's nothing I couldn't manage. However, could you elaborate how did u added these numbers and how change positions of numbers?
            – kravemir
            Jan 16 '15 at 9:48

















          up vote
          3
          down vote













          pdfimport for openoffice is a good alternative to edit PDF documents and re-export to PDF or save to another format. The imported PDF can be edited with OpenOffice Draw.






          share|improve this answer



























            up vote
            2
            down vote













            latex with the pdfpages packages can do most of these things.



            Specifically on how to add bookmarks, see http://michaelgoerz.net/blog/2011/04/pdf-bookmarks-with-latex/






            share|improve this answer




















            • Welcome to Stack Overflow. Please don't just link to external content, include the most relevant parts directly in your answer as well. (An answer containing only a link to your blog might well be considered spam.)
              – Gilles
              May 3 '11 at 21:44










            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f3378%2fmodifying-pdf-files%23new-answer', 'question_page');

            );

            Post as a guest






























            5 Answers
            5






            active

            oldest

            votes








            5 Answers
            5






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            18
            down vote



            accepted










            I use pdftk mainly. But here are some others to consider:



            pdfsam (PDF Split and Merge): "pdfsam is an open source tool (GPL license) designed to handle pdf files"



            PDFJam "A small collection of shell scripts which provide a simple interface to much of the functionality of the excellent pdfpages PDF file package (by Andreas Matthias) for pdfLaTeX." (You can also use pdfLaTeX directly.)



            jPDFTweak: "jPDF Tweak is a Java Swing application that can combine, split, rotate, reorder, watermark, encrypt, sign, and otherwise tweak PDF files."



            Inkscape: is a vector graphics editor that can both import PDF pages into its native SVG format, and also export as PDF.



            Calibre: Open source ebook management software that can convert PDFs to other formats, and manipulate them in other ways. Comes with command line tools such as pdfmanipulate which can be useful.



            Ghostscript of course can do a lot of things with PDF files too.






            share|improve this answer






















            • I use pdfjam but it seems none will do the 2 things I explicitly listed.
              – Maciej Piechotka
              Oct 21 '10 at 19:56






            • 1




              I misunderstood the question. Edit the question to make it clear what you meant by "chapters". I assumed you just wanted to insert one part of a PDF inside another. But perhaps you mean the pdf bookmarks (i.e., which appear in the side pane for some viewers)? PDFJam might not, but the pdfpages package for PDFLaTeX, along with the LaTeX hyperref package, can handle those. pdfedit should be able to change page numbers. With pdfLaTeX/pdfpages you could clip the bottom of the page and add new ones. BRISS can crop off headers/footers too, but you'd have to add them back with something else.
              – frabjous
              Oct 21 '10 at 20:18










            • Oh, and mbPDFasm can apparently also do stuff with bookmarks, but I've never used it: thierry.schmit.free.fr/spip/spip.php?article15&lang=en
              – frabjous
              Oct 21 '10 at 20:24






            • 2




              Another: jPDFBookmarks: flavianopetrocchi.blogspot.com/2009/03/…
              – frabjous
              Oct 21 '10 at 20:27














            up vote
            18
            down vote



            accepted










            I use pdftk mainly. But here are some others to consider:



            pdfsam (PDF Split and Merge): "pdfsam is an open source tool (GPL license) designed to handle pdf files"



            PDFJam "A small collection of shell scripts which provide a simple interface to much of the functionality of the excellent pdfpages PDF file package (by Andreas Matthias) for pdfLaTeX." (You can also use pdfLaTeX directly.)



            jPDFTweak: "jPDF Tweak is a Java Swing application that can combine, split, rotate, reorder, watermark, encrypt, sign, and otherwise tweak PDF files."



            Inkscape: is a vector graphics editor that can both import PDF pages into its native SVG format, and also export as PDF.



            Calibre: Open source ebook management software that can convert PDFs to other formats, and manipulate them in other ways. Comes with command line tools such as pdfmanipulate which can be useful.



            Ghostscript of course can do a lot of things with PDF files too.






            share|improve this answer






















            • I use pdfjam but it seems none will do the 2 things I explicitly listed.
              – Maciej Piechotka
              Oct 21 '10 at 19:56






            • 1




              I misunderstood the question. Edit the question to make it clear what you meant by "chapters". I assumed you just wanted to insert one part of a PDF inside another. But perhaps you mean the pdf bookmarks (i.e., which appear in the side pane for some viewers)? PDFJam might not, but the pdfpages package for PDFLaTeX, along with the LaTeX hyperref package, can handle those. pdfedit should be able to change page numbers. With pdfLaTeX/pdfpages you could clip the bottom of the page and add new ones. BRISS can crop off headers/footers too, but you'd have to add them back with something else.
              – frabjous
              Oct 21 '10 at 20:18










            • Oh, and mbPDFasm can apparently also do stuff with bookmarks, but I've never used it: thierry.schmit.free.fr/spip/spip.php?article15&lang=en
              – frabjous
              Oct 21 '10 at 20:24






            • 2




              Another: jPDFBookmarks: flavianopetrocchi.blogspot.com/2009/03/…
              – frabjous
              Oct 21 '10 at 20:27












            up vote
            18
            down vote



            accepted







            up vote
            18
            down vote



            accepted






            I use pdftk mainly. But here are some others to consider:



            pdfsam (PDF Split and Merge): "pdfsam is an open source tool (GPL license) designed to handle pdf files"



            PDFJam "A small collection of shell scripts which provide a simple interface to much of the functionality of the excellent pdfpages PDF file package (by Andreas Matthias) for pdfLaTeX." (You can also use pdfLaTeX directly.)



            jPDFTweak: "jPDF Tweak is a Java Swing application that can combine, split, rotate, reorder, watermark, encrypt, sign, and otherwise tweak PDF files."



            Inkscape: is a vector graphics editor that can both import PDF pages into its native SVG format, and also export as PDF.



            Calibre: Open source ebook management software that can convert PDFs to other formats, and manipulate them in other ways. Comes with command line tools such as pdfmanipulate which can be useful.



            Ghostscript of course can do a lot of things with PDF files too.






            share|improve this answer














            I use pdftk mainly. But here are some others to consider:



            pdfsam (PDF Split and Merge): "pdfsam is an open source tool (GPL license) designed to handle pdf files"



            PDFJam "A small collection of shell scripts which provide a simple interface to much of the functionality of the excellent pdfpages PDF file package (by Andreas Matthias) for pdfLaTeX." (You can also use pdfLaTeX directly.)



            jPDFTweak: "jPDF Tweak is a Java Swing application that can combine, split, rotate, reorder, watermark, encrypt, sign, and otherwise tweak PDF files."



            Inkscape: is a vector graphics editor that can both import PDF pages into its native SVG format, and also export as PDF.



            Calibre: Open source ebook management software that can convert PDFs to other formats, and manipulate them in other ways. Comes with command line tools such as pdfmanipulate which can be useful.



            Ghostscript of course can do a lot of things with PDF files too.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Sep 25 at 17:27









            Somebody62

            34




            34










            answered Oct 21 '10 at 19:28









            frabjous

            4,2221825




            4,2221825











            • I use pdfjam but it seems none will do the 2 things I explicitly listed.
              – Maciej Piechotka
              Oct 21 '10 at 19:56






            • 1




              I misunderstood the question. Edit the question to make it clear what you meant by "chapters". I assumed you just wanted to insert one part of a PDF inside another. But perhaps you mean the pdf bookmarks (i.e., which appear in the side pane for some viewers)? PDFJam might not, but the pdfpages package for PDFLaTeX, along with the LaTeX hyperref package, can handle those. pdfedit should be able to change page numbers. With pdfLaTeX/pdfpages you could clip the bottom of the page and add new ones. BRISS can crop off headers/footers too, but you'd have to add them back with something else.
              – frabjous
              Oct 21 '10 at 20:18










            • Oh, and mbPDFasm can apparently also do stuff with bookmarks, but I've never used it: thierry.schmit.free.fr/spip/spip.php?article15&lang=en
              – frabjous
              Oct 21 '10 at 20:24






            • 2




              Another: jPDFBookmarks: flavianopetrocchi.blogspot.com/2009/03/…
              – frabjous
              Oct 21 '10 at 20:27
















            • I use pdfjam but it seems none will do the 2 things I explicitly listed.
              – Maciej Piechotka
              Oct 21 '10 at 19:56






            • 1




              I misunderstood the question. Edit the question to make it clear what you meant by "chapters". I assumed you just wanted to insert one part of a PDF inside another. But perhaps you mean the pdf bookmarks (i.e., which appear in the side pane for some viewers)? PDFJam might not, but the pdfpages package for PDFLaTeX, along with the LaTeX hyperref package, can handle those. pdfedit should be able to change page numbers. With pdfLaTeX/pdfpages you could clip the bottom of the page and add new ones. BRISS can crop off headers/footers too, but you'd have to add them back with something else.
              – frabjous
              Oct 21 '10 at 20:18










            • Oh, and mbPDFasm can apparently also do stuff with bookmarks, but I've never used it: thierry.schmit.free.fr/spip/spip.php?article15&lang=en
              – frabjous
              Oct 21 '10 at 20:24






            • 2




              Another: jPDFBookmarks: flavianopetrocchi.blogspot.com/2009/03/…
              – frabjous
              Oct 21 '10 at 20:27















            I use pdfjam but it seems none will do the 2 things I explicitly listed.
            – Maciej Piechotka
            Oct 21 '10 at 19:56




            I use pdfjam but it seems none will do the 2 things I explicitly listed.
            – Maciej Piechotka
            Oct 21 '10 at 19:56




            1




            1




            I misunderstood the question. Edit the question to make it clear what you meant by "chapters". I assumed you just wanted to insert one part of a PDF inside another. But perhaps you mean the pdf bookmarks (i.e., which appear in the side pane for some viewers)? PDFJam might not, but the pdfpages package for PDFLaTeX, along with the LaTeX hyperref package, can handle those. pdfedit should be able to change page numbers. With pdfLaTeX/pdfpages you could clip the bottom of the page and add new ones. BRISS can crop off headers/footers too, but you'd have to add them back with something else.
            – frabjous
            Oct 21 '10 at 20:18




            I misunderstood the question. Edit the question to make it clear what you meant by "chapters". I assumed you just wanted to insert one part of a PDF inside another. But perhaps you mean the pdf bookmarks (i.e., which appear in the side pane for some viewers)? PDFJam might not, but the pdfpages package for PDFLaTeX, along with the LaTeX hyperref package, can handle those. pdfedit should be able to change page numbers. With pdfLaTeX/pdfpages you could clip the bottom of the page and add new ones. BRISS can crop off headers/footers too, but you'd have to add them back with something else.
            – frabjous
            Oct 21 '10 at 20:18












            Oh, and mbPDFasm can apparently also do stuff with bookmarks, but I've never used it: thierry.schmit.free.fr/spip/spip.php?article15&lang=en
            – frabjous
            Oct 21 '10 at 20:24




            Oh, and mbPDFasm can apparently also do stuff with bookmarks, but I've never used it: thierry.schmit.free.fr/spip/spip.php?article15&lang=en
            – frabjous
            Oct 21 '10 at 20:24




            2




            2




            Another: jPDFBookmarks: flavianopetrocchi.blogspot.com/2009/03/…
            – frabjous
            Oct 21 '10 at 20:27




            Another: jPDFBookmarks: flavianopetrocchi.blogspot.com/2009/03/…
            – frabjous
            Oct 21 '10 at 20:27












            up vote
            12
            down vote













            I know two programs for manipulating PDFs under Linux:



            PDEedit "PDFedit is a free open source pdf editor and a library for manipulating PDF documents, released under terms of GNU GPL version 2. It includes PDF manipulating library based on xpdf, GUI, set of command line tools and a pdf editor."



            and
            pdftk "If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents."






            share|improve this answer






















            • pdfedit: I don't have qt3 and I cannot install it (not in portage) & I cannot get it to compile with qt4 (even with qt3support).
              – Maciej Piechotka
              Oct 21 '10 at 19:36














            up vote
            12
            down vote













            I know two programs for manipulating PDFs under Linux:



            PDEedit "PDFedit is a free open source pdf editor and a library for manipulating PDF documents, released under terms of GNU GPL version 2. It includes PDF manipulating library based on xpdf, GUI, set of command line tools and a pdf editor."



            and
            pdftk "If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents."






            share|improve this answer






















            • pdfedit: I don't have qt3 and I cannot install it (not in portage) & I cannot get it to compile with qt4 (even with qt3support).
              – Maciej Piechotka
              Oct 21 '10 at 19:36












            up vote
            12
            down vote










            up vote
            12
            down vote









            I know two programs for manipulating PDFs under Linux:



            PDEedit "PDFedit is a free open source pdf editor and a library for manipulating PDF documents, released under terms of GNU GPL version 2. It includes PDF manipulating library based on xpdf, GUI, set of command line tools and a pdf editor."



            and
            pdftk "If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents."






            share|improve this answer














            I know two programs for manipulating PDFs under Linux:



            PDEedit "PDFedit is a free open source pdf editor and a library for manipulating PDF documents, released under terms of GNU GPL version 2. It includes PDF manipulating library based on xpdf, GUI, set of command line tools and a pdf editor."



            and
            pdftk "If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents."







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 20 at 11:14









            Jeff Schaller

            33.3k850112




            33.3k850112










            answered Oct 21 '10 at 18:57









            fschmitt

            7,4962942




            7,4962942











            • pdfedit: I don't have qt3 and I cannot install it (not in portage) & I cannot get it to compile with qt4 (even with qt3support).
              – Maciej Piechotka
              Oct 21 '10 at 19:36
















            • pdfedit: I don't have qt3 and I cannot install it (not in portage) & I cannot get it to compile with qt4 (even with qt3support).
              – Maciej Piechotka
              Oct 21 '10 at 19:36















            pdfedit: I don't have qt3 and I cannot install it (not in portage) & I cannot get it to compile with qt4 (even with qt3support).
            – Maciej Piechotka
            Oct 21 '10 at 19:36




            pdfedit: I don't have qt3 and I cannot install it (not in portage) & I cannot get it to compile with qt4 (even with qt3support).
            – Maciej Piechotka
            Oct 21 '10 at 19:36










            up vote
            5
            down vote













            The only way I found to add page numbers to a PDF was with LaTeX:



            Create a file /usr/local/bin/add-page-numbers.tex



            documentclass[8pt]article
            usepackage[final]pdfpages
            usepackagefancyhdr

            topmargin 70pt
            oddsidemargin 150pt

            pagestylefancy
            rfootLargethepage
            cfoot
            renewcommand headrulewidth0pt
            renewcommand footrulewidth0pt

            begindocument
            includepdfsetpagecommand=thispagestylefancy
            includepdf[pages=-]input.pdf
            enddocument


            And a file /usr/local/bin/pdf-numbers



            #!/bin/bash
            name="$1%.pdf-numbers"
            wd="$(pwd)"
            dir=/tmp/pdf-numbers
            mkdir -p "$dir"
            cp "$1" "$dir/input.pdf"
            cd "$dir"
            pdflatex --jobname "$name" /usr/local/bin/add-page-numbers.tex > /dev/null
            mv "$name.pdf" "$wd"
            rm -r "$dir"


            Make the latter file executable, and run it with



             pdf-numbers example.pdf


            It will create a pdf file called example-numbers.pdf (and overwrite it if it already exists!).






            share|improve this answer




















            • Working very well. Imperfection lies in absolute paths, but that's nothing I couldn't manage. However, could you elaborate how did u added these numbers and how change positions of numbers?
              – kravemir
              Jan 16 '15 at 9:48














            up vote
            5
            down vote













            The only way I found to add page numbers to a PDF was with LaTeX:



            Create a file /usr/local/bin/add-page-numbers.tex



            documentclass[8pt]article
            usepackage[final]pdfpages
            usepackagefancyhdr

            topmargin 70pt
            oddsidemargin 150pt

            pagestylefancy
            rfootLargethepage
            cfoot
            renewcommand headrulewidth0pt
            renewcommand footrulewidth0pt

            begindocument
            includepdfsetpagecommand=thispagestylefancy
            includepdf[pages=-]input.pdf
            enddocument


            And a file /usr/local/bin/pdf-numbers



            #!/bin/bash
            name="$1%.pdf-numbers"
            wd="$(pwd)"
            dir=/tmp/pdf-numbers
            mkdir -p "$dir"
            cp "$1" "$dir/input.pdf"
            cd "$dir"
            pdflatex --jobname "$name" /usr/local/bin/add-page-numbers.tex > /dev/null
            mv "$name.pdf" "$wd"
            rm -r "$dir"


            Make the latter file executable, and run it with



             pdf-numbers example.pdf


            It will create a pdf file called example-numbers.pdf (and overwrite it if it already exists!).






            share|improve this answer




















            • Working very well. Imperfection lies in absolute paths, but that's nothing I couldn't manage. However, could you elaborate how did u added these numbers and how change positions of numbers?
              – kravemir
              Jan 16 '15 at 9:48












            up vote
            5
            down vote










            up vote
            5
            down vote









            The only way I found to add page numbers to a PDF was with LaTeX:



            Create a file /usr/local/bin/add-page-numbers.tex



            documentclass[8pt]article
            usepackage[final]pdfpages
            usepackagefancyhdr

            topmargin 70pt
            oddsidemargin 150pt

            pagestylefancy
            rfootLargethepage
            cfoot
            renewcommand headrulewidth0pt
            renewcommand footrulewidth0pt

            begindocument
            includepdfsetpagecommand=thispagestylefancy
            includepdf[pages=-]input.pdf
            enddocument


            And a file /usr/local/bin/pdf-numbers



            #!/bin/bash
            name="$1%.pdf-numbers"
            wd="$(pwd)"
            dir=/tmp/pdf-numbers
            mkdir -p "$dir"
            cp "$1" "$dir/input.pdf"
            cd "$dir"
            pdflatex --jobname "$name" /usr/local/bin/add-page-numbers.tex > /dev/null
            mv "$name.pdf" "$wd"
            rm -r "$dir"


            Make the latter file executable, and run it with



             pdf-numbers example.pdf


            It will create a pdf file called example-numbers.pdf (and overwrite it if it already exists!).






            share|improve this answer












            The only way I found to add page numbers to a PDF was with LaTeX:



            Create a file /usr/local/bin/add-page-numbers.tex



            documentclass[8pt]article
            usepackage[final]pdfpages
            usepackagefancyhdr

            topmargin 70pt
            oddsidemargin 150pt

            pagestylefancy
            rfootLargethepage
            cfoot
            renewcommand headrulewidth0pt
            renewcommand footrulewidth0pt

            begindocument
            includepdfsetpagecommand=thispagestylefancy
            includepdf[pages=-]input.pdf
            enddocument


            And a file /usr/local/bin/pdf-numbers



            #!/bin/bash
            name="$1%.pdf-numbers"
            wd="$(pwd)"
            dir=/tmp/pdf-numbers
            mkdir -p "$dir"
            cp "$1" "$dir/input.pdf"
            cd "$dir"
            pdflatex --jobname "$name" /usr/local/bin/add-page-numbers.tex > /dev/null
            mv "$name.pdf" "$wd"
            rm -r "$dir"


            Make the latter file executable, and run it with



             pdf-numbers example.pdf


            It will create a pdf file called example-numbers.pdf (and overwrite it if it already exists!).







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 20 '11 at 11:12









            Dario Seidl

            1,2931210




            1,2931210











            • Working very well. Imperfection lies in absolute paths, but that's nothing I couldn't manage. However, could you elaborate how did u added these numbers and how change positions of numbers?
              – kravemir
              Jan 16 '15 at 9:48
















            • Working very well. Imperfection lies in absolute paths, but that's nothing I couldn't manage. However, could you elaborate how did u added these numbers and how change positions of numbers?
              – kravemir
              Jan 16 '15 at 9:48















            Working very well. Imperfection lies in absolute paths, but that's nothing I couldn't manage. However, could you elaborate how did u added these numbers and how change positions of numbers?
            – kravemir
            Jan 16 '15 at 9:48




            Working very well. Imperfection lies in absolute paths, but that's nothing I couldn't manage. However, could you elaborate how did u added these numbers and how change positions of numbers?
            – kravemir
            Jan 16 '15 at 9:48










            up vote
            3
            down vote













            pdfimport for openoffice is a good alternative to edit PDF documents and re-export to PDF or save to another format. The imported PDF can be edited with OpenOffice Draw.






            share|improve this answer
























              up vote
              3
              down vote













              pdfimport for openoffice is a good alternative to edit PDF documents and re-export to PDF or save to another format. The imported PDF can be edited with OpenOffice Draw.






              share|improve this answer






















                up vote
                3
                down vote










                up vote
                3
                down vote









                pdfimport for openoffice is a good alternative to edit PDF documents and re-export to PDF or save to another format. The imported PDF can be edited with OpenOffice Draw.






                share|improve this answer












                pdfimport for openoffice is a good alternative to edit PDF documents and re-export to PDF or save to another format. The imported PDF can be edited with OpenOffice Draw.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 21 '10 at 21:17







                oposit



























                    up vote
                    2
                    down vote













                    latex with the pdfpages packages can do most of these things.



                    Specifically on how to add bookmarks, see http://michaelgoerz.net/blog/2011/04/pdf-bookmarks-with-latex/






                    share|improve this answer




















                    • Welcome to Stack Overflow. Please don't just link to external content, include the most relevant parts directly in your answer as well. (An answer containing only a link to your blog might well be considered spam.)
                      – Gilles
                      May 3 '11 at 21:44














                    up vote
                    2
                    down vote













                    latex with the pdfpages packages can do most of these things.



                    Specifically on how to add bookmarks, see http://michaelgoerz.net/blog/2011/04/pdf-bookmarks-with-latex/






                    share|improve this answer




















                    • Welcome to Stack Overflow. Please don't just link to external content, include the most relevant parts directly in your answer as well. (An answer containing only a link to your blog might well be considered spam.)
                      – Gilles
                      May 3 '11 at 21:44












                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    latex with the pdfpages packages can do most of these things.



                    Specifically on how to add bookmarks, see http://michaelgoerz.net/blog/2011/04/pdf-bookmarks-with-latex/






                    share|improve this answer












                    latex with the pdfpages packages can do most of these things.



                    Specifically on how to add bookmarks, see http://michaelgoerz.net/blog/2011/04/pdf-bookmarks-with-latex/







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 3 '11 at 14:16









                    Michael Goerz

                    1211




                    1211











                    • Welcome to Stack Overflow. Please don't just link to external content, include the most relevant parts directly in your answer as well. (An answer containing only a link to your blog might well be considered spam.)
                      – Gilles
                      May 3 '11 at 21:44
















                    • Welcome to Stack Overflow. Please don't just link to external content, include the most relevant parts directly in your answer as well. (An answer containing only a link to your blog might well be considered spam.)
                      – Gilles
                      May 3 '11 at 21:44















                    Welcome to Stack Overflow. Please don't just link to external content, include the most relevant parts directly in your answer as well. (An answer containing only a link to your blog might well be considered spam.)
                    – Gilles
                    May 3 '11 at 21:44




                    Welcome to Stack Overflow. Please don't just link to external content, include the most relevant parts directly in your answer as well. (An answer containing only a link to your blog might well be considered spam.)
                    – Gilles
                    May 3 '11 at 21:44

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f3378%2fmodifying-pdf-files%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay