Skip to content

Instantly share code, notes, and snippets.

@digitalm
Created July 20, 2018 03:39
Show Gist options
  • Save digitalm/b0b6d6781d14ba5157a323c5fbb42929 to your computer and use it in GitHub Desktop.
Save digitalm/b0b6d6781d14ba5157a323c5fbb42929 to your computer and use it in GitHub Desktop.
ghostscript command sample
# get whole page size from sample.pdf
# 総ページ数を取得
$ gs -q -dNODISPLAY -c '(sample.pdf) (r) file runpdfbegin pdfpagecount = quit'
# take perticular page from sample.pdf with sequential file name like printed_0001.pdf, printed_0002.pdf
# 特定範囲のページを取り出す
# 総ページ数でループすれば、分割にも応用可
$ gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dFirstPage=1 -dLastPage=1 -sOutputFile=printed_%04d.pdf sample.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment