How to add page numbers to Postscript/PDF

前端 未结 14 1925
臣服心动
臣服心动 2020-12-07 12:06

If you\'ve got a large document (500 pages+) in Postscript and want to add page numbers, does anyone know how to do this?

14条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 12:09

    You can use the free and open source pdftools to add page numbers to a PDF file with a single command line.

    The command line you could use is:

    pdftools --input-file input.pdf --output output.pdf --text $page/$pages 0.9 0.9 --fitpaper
    

    Regarding the --text option:

    • The first parameter is the text to add. Some placeholders are available. $page stands for the current page number, while $pages stands for the total number of pages in the PDF file. Thus the option so formulated would add something like "1/10" for the first page of a 10-page PDF document, and so on for the following pages
    • The second parameter is the horizontal position of the text as a percentage of the page size
    • The third parameter option is the vertical position of the text as a percentage of the page size

    The --fitpaper option is used to maintain the dimension of the input pdf file in the output pdf file.

    Disclaimer: I'm the author of pdftools

提交回复
热议问题