Add margin to PDF file when merging using PDFTK or similar

前端 未结 3 1957
萌比男神i
萌比男神i 2021-02-04 09:36

I have a large collection of half-page sized PDF cut-sheets that are held in a folder on my Linux server. A user to the site will want to create a booklet from a subset<

3条回答
  •  -上瘾入骨i
    2021-02-04 10:33

    If you use ubuntu, you can install pdfcrop:

    sudo apt-get install -y pdfcrop
    

    Despite its name, pdfcrop has the option to add margins:

    pdfcrop --margin '29 0 29 0' input.pdf output.pdf
    

    (Note: the unit is bp. 72 bp = 1 inch. 29 bp is approximately 1 cm.)

    Then, use pdfjam to do the offset trick for the right and left pages.

    pdfjam --twoside --offset '1cm 0cm' file.pdf
    

    Note: pdfcrop does have problems with some pdf files. (!!! Error: Ghostscript exited with error code 139!).

提交回复
热议问题