#Linux One-liners to manage pdf documents

Words
137
Reading
1 min
Listen
Play
6y

Set a black background with ImageMagick: a brute‑force method that rasterizes the vector and significantly increases file size.
convert -density 300 input_white.pdf -background black -negate output_dark.pdf

Merge many .jpg files into one pdf
convert *.jpg doc.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.







please feel free to write comments suggestions and alternatives

untitled.gif





WE ARE ON A BLOCKCHAIN SO... [disclaimer] This is a new re-edited post on an old deleted one (so saved to the same blockchain block/link) and this is why you may notice discrepancies in such things as the first hashtag, title/permalink to the blockchain, date of the post, topic/date of the comments, reported likes and their date and so on.

#Linux One-liners to manage pdf documents | Ecency