#Linux Seven one-liners to manage PDF documents.

in #linux6 years ago

Merge many .jpg files into one pdf.
convert *.jpg doc.pdf

Rotate a single page PDF by 90 degrees right.
pdftk my.pdf cat 1east output out.pdf

Set a password.
pdftk file.pdf output file_pw.pdf userpw PROMPT

UnSet a password (two options).
pdftk file_pw.pdf output file.pdf user_pw MYPASSWD
qpdf --password=MYPASSWD --decrypt crypt.pdf de_crypt.pdf

Remove pages.
pdftk old.pdf cat 1-9 15-end output new.pdf

Merge many docs.
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

Reduce doc size.

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH ->sOutputFile=output.pdf input.pdf

The option /screen defines the most quality degree and size reduction factor.
Here the complete list of options from low to high quality: /screen, /default, /ebook, /printer,/prepress.


There is a typo in "Reduce doc size". Below the corrected version:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input

Coin Marketplace

STEEM 0.17
TRX 0.08
JST 0.023
BTC 26576.16
ETH 1593.23
USDT 1.00
SBD 2.16