Skip to content

Instantly share code, notes, and snippets.

@MaxAtoms
Last active February 5, 2023 14:33
Show Gist options
  • Save MaxAtoms/0b5517977123cf1589a90f47985ca24b to your computer and use it in GitHub Desktop.
Save MaxAtoms/0b5517977123cf1589a90f47985ca24b to your computer and use it in GitHub Desktop.
PDF Command Line Tools

Remove bookmarks/table of contents from a PDF:

pdftk A=file1.pdf cat A1-end output nobookmarks.pdf

Concatenate multiple PDF files:

pdftk \
    file1.pdf \
    file2.pdf \
    output combined.pdf

Rotate single page:

pdftk in.pdf cat 1south output out.pdf

Combine four slides on one page:

pdfnup --nup 2x2 --suffix print example.pdf

Add an empty page between two pages:

pdfjam example.pdf 1,{},2 --nup 1x2 --suffix 2up --outfile exampleprint.pdf

Create a new PDF with only selected pages from the input PDF:

pdftk A=file.pdf cat A16 A18 A20-22 A171-end output output.pdf

Create a PDF file from Markdown:

pandoc example.md --metadata geometry="left=3cm,right=3cm,top=2cm,bottom=2cm" -o example.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment