Playing with PDFs Playing with PDFs

July 4, 2020


I have always loved reading, on my computer, phone, books, magazines and newspapers. I have collected a huge number of PDFs over the years.

Printing a webpage to a PDF

I regularly save webpages as PDFs to keep a copy of a webpage I want to read, often on my tablet or phone. These are my favourite Addons / Extensions to print webpages directly from the browser:

FirefoxFirefox Add-on Adobe's Save PDF / Print PDF

ChromeGoogle Chrome Extension Print Friendly PDF

Scanning pages to PDF

Recently i have acquired a scanner and on my debian linux laptop, I have been using gscan2pdf to scan pages straight into a pdf document. To install this on debian use:

apt-get install gscan2pdf

This opens a simple GUI which found the HP Scanner and was really simple to use. It allows you to keep scanning pages into a single PDF, which was exactly what i wanted.

Converting EPUB to PDF

Recently, I also wanted to convert an EPUB book into a PDF. Installing Calibre provides the Command Line tool - ebook convert. To Install use

apt-get install calibre

And then to convert the document from the epub format to pdf was simply running

ebook-convert .epub .pdf

Command line HTML to PDF

I have a large html document that I wanted to save to a pdf. I used wkhtmltopdf to save the page as a pdf. To install apt-get install wkhtmltopdf

Then to create the pdf locally I run

wkhtmltopdf --page-size A4 --lowquality --encoding UTF-8 --no-pdf-compression --disable-javascript --orientation Portrait --dpi 65 --margin-top 0.2in --margin-right 0in --margin-bottom 0.3in --margin-left 0in --footer-center "[page]" --print-media-type --no-outline --image-quality 100 --user-style-sheet "http://localhost/bizjet.css" cover "http://localhost/cover.html" "http://localhost/planes/txt" "planes.pdf"

Extracting pages from a PDF

I wanted to extract 2 pages from a pdf file using pdftk

apt-get install pdftk

then to extract pages 5 and 6 use

pdftk source.pdf cat 5 6 output output.pdf

Looking for more info about PDF's

Whilst writing this article, I tried to find cheatsheets and books about PDF's but I couldn't find anything. If you know any books about PDF's, cheatsheets or documents about them, please contact me on twitter @allotmentandy1. Hope you find this article useful.

If you would like to contact me you can either use this form on or via Twitter @andylondon