Skip to content

Instantly share code, notes, and snippets.

@sandboiii
Last active May 19, 2024 19:54
Show Gist options
  • Save sandboiii/3c94d0286e6d8a62743e96fedb57df38 to your computer and use it in GitHub Desktop.
Save sandboiii/3c94d0286e6d8a62743e96fedb57df38 to your computer and use it in GitHub Desktop.
pdf shell commands cheatsheet

Create pdf file from images

convert image_*.jpg image.pdf

Compress pdf file

V1:

convert doc.pdf -compress Zip doc_compressed.pdf

V2:

qpdf --linearize doc.pdf doc_compressed.pdf

Extract pages from pdf file

V1:

qpdf full_doc.pdf --pages . 12-15,17-20 -- doc_pages.pdf

V2:

pdftk full_doc.pdf cat 12-15 17-20 output doc_pages.pdf

Concatenate multiple pdf files into one

V1:

qpdf --empty --pages file1.pdf file2.pdf -- both_files.pdf

V2:

pdftk file1.pdf file2.pdf cat output both_files.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment