Landscape Reading on Remarkable Tablets

The remarkable2 is a great device for taking handwritten notes and reading. It has a large e-ink screen, sleek design and the low latency and resitance when writing make it feel very natural to write on. The software does leave a little bit to be desired and there are many rough edges when trying to do things one would expect to be relatively simple. One particularly annoying feature that is lacking is the ability to rotate documents and read in landscape mode. The usable screen size is 155mmx210mm compared to A4 which is 210mmx297mm. This makes reading papers and technical documents a challenge. While there is a zoom funtion, it is very clunky and slow to navigate around the document, making this unusable in practice.

I had a look around to see if there were some scripts or tools that would help with this, but came up empty handed so had a go at putting something together myself. The idea was to convert each page of a pdf into two pages, one covering the upper half and the other covering the lower half, with the page rotated 90 degrees counterclock wise and an overlap between the two pages to keep the aspect ratio similar and also to make it easier to keep track of the reading location when switching pages.

fig

To help with parsing pdf documents I found the pure python PyPDF2 package which provides a simple interface for manipulating pdf documents. Using this package it was relatively simple to put together the code to rotate each page and crop to the area of interest. The following python function does this by creating two reader objects and using one for the top of the pages and the other for the bottom.

import PyPDF2 as pdf

def convert_to_landscape(fn, out_fn, verbose=False):
    reader = pdf.PdfFileReader(fn)
    reader2 = pdf.PdfFileReader(fn)
    writer = pdf.PdfFileWriter()

    number_pages = reader.getNumPages()
    for pn in range(number_pages):
        if verbose: print(f'Onto page {pn}')
        page = reader.getPage(pn)        
        page2 = reader2.getPage(pn)
        b = page.cropBox
        ar = b[3]/b[2]
        crop_height = int(b[2]/ar)        
        page.rotateCounterClockwise(90)
        page.cropBox = pdf.generic.RectangleObject([0, b[3]-crop_height, 612, b[3]])
        writer.addPage(page)
        page2.rotateCounterClockwise(90)
        page2.cropBox = pdf.generic.RectangleObject([0, 0, 612, crop_height])
        writer.addPage(page2)

    if verbose: print("Done processing pages and now writing them to the file")
    with open(out_fn, "wb") as io:
        writer.write(io)

For convenience I created a simple python package called landscape_pdf and registered it with the PyPI registry so it can be installed directly using pip install landscape_pdf. I also submitted a pull request to the zotrm package so that it can be used to transform pdf documents automatically when synchronising these from zotero.