TanNoisEr-IT avatar

#Linux One-liners to manage pdf documents

oneshot

Published: 20 Nov 2020 › Updated: 20 Nov 2020#Linux One-liners to manage pdf documents

#Linux One-liners to manage pdf documents

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.

Leave #Linux One-liners to manage pdf documents to:

Written by

Tech blog. Mainly focused on Linux and Free Software, featuring geeky articles and personal insights.

Read more #covid19 posts


Best Posts From TanNoisEr-IT

We have not curated any of oneshot's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From TanNoisEr-IT