~/Blog

Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

PDF To Kindle

Published on

Updated on

Warning: This post has not been modified for over 2 years. For technical posts, make sure that it is still relevant.

This post will outline a process I take in order to get content from a website onto my Kindle.

Suggested Software

  • To save a webpage as a PDF, we will use WeasyPrint.
  • To convert the PDF into a more Kindle readable format, including converting math type properly, we’re going to use k2pdfopt.
  • Finally we’re going to use Calibre to copy metadata and convert to an ebook format.
sudo apt install weasyprint k2pdfopt calibre

Process

Now I’ll show how we can take the Noise Protocol specification and send it to the Kindle.

First let’s download the page as a PDF

weasyprint https://noiseprotocol.org/noise.html noise.pdf

Then let’s use k2pdfopt to convert the PDF to a more Kindle friendly format,

k2pdfopt noise.pdf -ui- -x

This will produce the file noise_k2opt.pdf, but sadly without the metadata. We can copy that over,

ebook-meta noise.pdf --to-opf temp.opf && \
ebook-meta noise_k2opt.pdf --from-opf temp.opf && \
rm temp.opf

Finally we can convert it to a Kindle friendly file format.

ebook-convert noise_k2opt.pdf noise.azw3

This will give us noise.azw3 which we can then transfer over to the Kindle.

Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter

Published a response to this? :