k2pdfopt for Reading Academic Papers on a Kindle

2017-07-21

Kindles are very nice e-readers because of the e-ink technology. There is less eye-strain than with a normal tablet. Kindles are nice for reading books specifically formatted for smaller screens, but they do not handle larger PDFs like research papers very well. The small screen size makes it awkward.

However, there is an application called k2pdfopt that reformats academic research papers to be readable on a Kindle.

Here's an example of what an academic research paper looks like as a PDF1:

academic research paper pre-format\

Here is what the same paper looks like after having been reformatted with k2pdfopt:

academic research paper post-format\

You can see that it will fit much better on the small screen of a Kindle.

Running k2pdfopt

Given a PDF-format research paper paper.pdf, k2pdfopt can be run like the following from the command line:

$ k2pdfopt -dev kp3 -vls -3 -vb 1.25 paper.pdf

This drops you into a text-mode application that looks like the following:

k2pdfopt v2.41 (w/MuPDF,DjVuLibre,OCR) (c) 2017, GPLv3, http://willus.com
    Compiled Jul 17 2017 with Gnu C v7.1.1 for Linux on x64.

 a. Autostraighten (-as)                 n. Native PDF output (-n)
 b. Bitmap type (-jpg,-png,-bpc)         o. Output name (-o)
bp. Break pages (-bp,-f2p)              oc. OCR (-ocr,-ocrvis,...)
 c. Color/Negative output (-c, -neg)    om. Output margins (-om)
co. Column detection (-col,-ch,...)      p. Page range (-p)
cs. Contrast/Sharpen (-cmax,-g,-s,-wt)  pd. Padding/Marking (-p[lrbt],-mc)
 d. Device selection (-dev,-h,-w,-dpi)   r. Right-to-left page scans (-r)
ds. Document scale factor (-ds)         rt. Rotate source page (-sr)
 f. Fit to single column (-fc)           s. Special (-de,-evl,-gs)
gt. Gap thresholds (-gt...)             sm. Show marked source (-sm)
 j. Justification (-j)                   u. Usage (command line opts)
 l. Landscape mode (-ls)                 v. Vertical spacing (-vb,-vs)
 m. Margin to ignore (-m)                w. Wrap/Reflow text (-wrap,-ws)
mo. Mode (-mode)                         x. Exit on completion (-x)

Selected options:  -dev kp3 -vls -3 -vb 1.25
    invertible-syntax-descriptions-convert.pdf

Enter option above (h=help, q=quit):

Pressing Enter here will create the reformatted PDF paper_k2opt.pdf.

Options

What do the options -dev kp3 -vls -3 -vb 1.25 do?

-dev kp3 tells k2pdfopt to use the preset defaults for the Kindle PaperWhite 3, since I own a Kindle PaperWhite. You can use the following command to see the different presets:

$ k2pdfopt -dev \?

You may need to try out some different presets to figure out which one works for your device.

-vls -3 -vb 1.25 tells k2pdfopt to keep the white space between paragraphs and code blocks. Without these two options, k2pdfopt will remove all white space between paragraphs and code blocks. The resulting PDFs look a little to cramped.

If you'd like to read about more options, you can find the full list of options here.

Other Useful Options

There are a few other options that can be useful. These include the -sm option for debugging and the -col option for working with papers with different numbers of columns.

-sm Option

The -sm option tells k2pdfopt to create a separate PDF for debugging. This debugging PDF is the exact same as the input PDF, except it has colored boxes showing the regions it finds. If the input PDF is called paper.pdf, the debug PDF will be saved as paper_marked.pdf.

Here is an example of the paper from above processed with the -sm option:

academic research paper debugged\

-col Option

The -col option allows you to tell k2pdfopt how many columns to search for in the input PDF. By default, it will assume the input PDF has 2 columns.

Here is an example of running k2pdfopt on a PDF with only 1 column:

$ k2pdfopt -dev kp3 -vls -3 -vb 1.25 -col 1 paper.pdf

Footnotes


  1. This is a section from the paper Invertible syntax descriptions: unifying parsing and pretty printing.↩︎