dcreager.net

Resizing PDFs to fit the Remarkable

Common sizes

For recent SIGPLAN papers, a bounding box of 45 60 450 636 is a good starting point.

For slightly less recent SIGPLAN papers, try 53 66 558 721.

For LNCS papers that are printed on a letter-sized page, try 134 126 484 677.

For OASIcs papers, try 90 106 92 490 765.

Detailed notes

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                    40     ┃
┃     ┌────────────────┐    ┃
┃ 160 │      1204      │ 40 ┃
┃     │                │    ┃
┃     │                │    ┃
┃     │                │    ┃
┃     │                │    ┃
┃     │                │    ┃
┃     │           1792 │    ┃ 1872
┃     │                │    ┃
┃     │                │    ┃
┃     │                │    ┃
┃     │                │    ┃
┃     │                │    ┃
┃     └────────────────┘    ┃
┃                    40     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
            1404

The pixel dimensions of the Remarkable 2 are 1404 × 1872. The width of the left sidebar is 120 pixels. I've chosen to add a 40-pixel margin around the content. That gives us total margins of 160L, 40T, 40R, and 40B. We need to resize the content of the PDF to fit within 1204 × 1792.

Aspect ratio of content:  1792 / 1204 = 1.488
Margin multipliers:
  LM = 160/1204 = 0.133
  TM =  40/1792 = 0.022
  RM =  40/1204 = 0.033
  BM =  40/1792 = 0.022

First, use pdfcrop to determine the bounding box of each page:

$ pdfcrop --verbose $ORIGINAL.pdf /tmp/fff.pdf

Manually inspect the output to see which bounding box to use. Normally you'll want to find a page that is representative and use its bounding box. There might be more space cropped from the top of the title page, for instance. Old scanned PDFs might not have the real pages lined up perfectly on each PDF page. Use your judgment to choose a initial guess for the bounding box that will work for all pages.

$ pdfcrop --verbose --box "L B R T" $ORIGINAL.pdf /tmp/fff.pdf
$ evince /tmp/fff.pdf &; disown

If your initial guess isn't right, tweak the numbers and rerun the pdfcrop command. Your evince window will automatically reload the PDF as you mess with it. (Note that the PDF bounding box uses the lower left corner of the page as the origin. That won't affect any calculations below, but you need to keep that in mind as you play with the bounding box coordinates.)

Once you're happy with the cropping, it's time to add the margins. As mentioned above, you want 160- and 40-pixel margins — but that should be applied to content that is 1204 × 1792. Your cropped PDF content is almost certainly not those dimensions.

First, the cropped PDF is probably not the right aspect ratio (1.488). Figure out what the aspect ratio is:

W = R - L
H = T - B
AR = H / W

If the aspect ratio is less than 1.488, then you need additional vertical padding:

NW = W
NH = W * 1.488
EW = 0
EH = (NH - H) / 2

If it's greater than 1.488, you need additional horizontal padding:

NW = H / 1.488
NH = H
EW = (NW - W) / 2
EH = 0

Then you need to multiply the desired margins (160 and 40) by your actual dimensions to get your scaled margins:

SL = (LM * NW) + EW
ST = (TM * NH) + EH
SR = (RM * NW) + EW
SB = (BM * NH) + EH

And then you can run the final pdfcrop command:

$ pdfcrop -m "SL ST SR SB" --bbox "L B R T" $ORIGINAL.pdf $REMARKABLE.pdf

» reMarkable tablet