Viewers
Evince
By default, Evince has a very annoying zoom limit Fix it with:
$ gsettings get org.gnome.Evince page-cache-size
uint32 512
$ gsettings set org.gnome.Evince page-cache-size 1024
Warning - may use a lot of RAM!
Merge/Rearrange multiple PDFs
GUI
pdfarranger Recently updated
sudo apt install pdfarranger
cli
pdfunite in-1.pdf in-2.pdf in-n.pdf out.pdf
Reduce PDF size
Usage:
ps2pdf input.pdf output.pdf
Convert images to PDF
With img2pdf
sudo apt install img2pdf
DINA4 portrait:
img2pdf --pagesize A4 --border 2cm:2.5cm a.png > a.pdf
DINA4 landscape:
img2pdf --pagesize A4^T --border 2cm:2.5cm a.png > a.pdf
Issues:
- Can't combine multiple images into one pdf page, each image creates a new PDF page
With imagemagick
Convert and scale jpg to DINA4 pdf:
convert a.jpg -compress jpeg -resize 1240x1753 -extent 1240x1753 \
-gravity center -units PixelsPerInch -density 150x150 a.pdf
convert b* -compress jpeg -resize 1240x1753 -extent 1240x1753 \
-gravity center -units PixelsPerInch -density 150x150 b.pdf
Combine multiple images in one PDF page:
montage src* -mode concatenate -tile 1x -resize 500x \
-page a4 -gravity center dst.pdf
Extract images from PDF
pdfimages -png document.pdf .
Convert PDF to high quality image
Convert PDF to image with high resolution
convert -verbose -density 150 -trim -quality 100 -flatten -sharpen 0x1.0 \
image.png
PDFTK
apt install pdftk-java
Remove password from pdf
How to remove the password from a PDF
qpdf --password=YOURPASSWORD-HERE --decrypt input.pdf output.pdf
Or: Open the protected file and use ctrl+p or use print optiont to print the file, now save the file as pdf.
PFD diff tools
Diffoscope
Best PDF diff tool so far ! Website
Install:
pamac install python-pypdf
sudo pacman -S diffoscope tinyxxd python-pdfminer
Usage:
diffoscope resume.pdf /tmp/resume.pdf
diff-pfd
Can't get a useful diff at all :/
Other diff viewers
- Online: diffchecker
- pdfdiff Last commit 2022-03
- pdf-diff Last commit 2019
Generate PDF
Markdown to PDF
see markdown.md "Generate PDF from markdown"
HTML to PDF
- How to Automate HTML-to-PDF Conversions
- For conversion examples using different tools see
~/projects/pdf/html-to-pdf-conversion-examples
Weasyprint
HTML -> PDF generator
Issues:
- Presentational hints like img size are ignored by default
- jsonresume PDF looks quite different to what the HTML shows in the browser
- Resulting PDF only has one page i.e. for jsonresume
- Reproducible PDF generation possible again
Various tools
- Pandoc PDFs generated from jsonresume look like shite
- wkhtmltopdf jsonresume PDF shows blurry subtitle and other text styles
- node-html-pdf
- Can't generate PDF from jsonresume: Auto Configuration Failed - libproviders.so: No such file or directory
- Outdated (last commit March 2021)
ebook-convert
fromcalibre
package jsonresume PDF look absolutely horribleunoconv
: Standalone tool which uses the LibrOffice library to convert documents from/to different formats jsonresume PDF look absolutely horrible- node-puppeteer-pdf-wrapper Silently finishes without PDF generation...
Headless chromium:
chromium --headless --disable-gpu --print-to-pdf='varac.pdf' --hide-scrollbars
--run-all-compositor-stages-before-draw --no-sandbox --virtual-time-budget=60000 varac.html`
- Most similar to html in browser, but with printing footer/header
- chrome-headless-render-pdf
- Doesn't work: endless Waiting for chrome to became available