As material continues to flow into some local prisons, I’ve worked out another few things that I think are worth sharing about, if you’ve decided you want a new hobby: How to print, pack, and ship ebooks (epub, mobi, etc), and how to sort out removing color from scans of things you might want to send in.

I’m not going to say this is all the easiest way to achieve things, but if you’re willing to play around a bit, this is yet another useful way to sort out sending content-dense material into prisons.
Starting Point: DRM-Free Ebooks
I’ve talked before about the art of slicing and dicing PDFs with some handy tools, and here, the starting point is an ebook - I’m mostly using epub
, but mobi
is a perfectly fine starting point too. You’ll need something that’s DRM free for this process, and that’s beyond the scope of this post.
You’ll need calibre
and texlive-extra-utils
installed, so go ahead and install those per your normal method. For anyone sane, sudo apt -y install calibre texlive-extra-utils
ought to get you what you need.
It’s worth noting that an awful lot of John Piper’s books have freely downloadable epubs - or PDFs, depending on what the book is.
The process is simple enough: Convert the epub into a temporary PDF, then use the pdfxup
utility to slice and dice that into an 8-up page that remains readable, if on the small side.
Build the PDF
To build the PDF, you’ll be using the command line ebook-convert
utility from the calibre
package. I’ve experimented with the page sizes for packing, and this seems to pack fairly efficiently on 8.5x11 letter paper, landscape, 4x2.
ebook-convert input.epub output.pdf --base-font-size 9 --custom-size 5.25x8 --pdf-page-numbers --pdf-page-margin-left 0 --pdf-page-margin-right 0 --pdf-page-margin-bottom 12 --pdf-page-margin-top 0 --minimum-line-height 100
Notes on the options used:
- base-font-size: This sets the font size you’ll use for the PDF render. I find, for most ebooks, “9” works fairly well once everything is scaled. If things are too small, you can make this larger, but it tends to rapidly expand page count - be careful, or accept you’re shipping a lot of pages in. Know your audience.
- custom-size: This is the page size coming out of the PDF rendering, in inches. This particular size packs very tightly into a 4x2 grid on letter paper with sane margins.
- pdf-page-numbers: You really want to make sure you include page numbers, so if someone drops the paper, they can put the book back in order. These settings occasionally clip the page numbers - they’re readable, but if you need more room, tweak the bottom margin.
- margins: No margins on the top and sides, enough on the bottom for the page numbers. It’s not the most comfortable for reading, but it keeps the density up, and that’s the goal here.
- minimum-line-height: This sets the line spacing in percent. You can tweak this up or down as you want, just make sure you preview the final output (or ideally print a page) to make sure it’s readable. It’s another knob you can twiddle for density.
Your output here is a PDF, rather dense. But we’re far from done here - this is just the feed into the next step, when things get really cozy!

8-Up the PDF
The next step is to pack the pages in tightly, using the pdfxup
tool I’ve talked about previously. Something like this will probably do what you want…
pdfxup --paper letter -x 4 -y 2 -l 1 -o output_4x2.pdf input.pdf

This will simply pack the PDF, 8 “pages per side,” so 16 pages per sheet when you print double sided! There’s not much to tweak here - it’s just doing the PDF packing, and you’ll notice very few margins between the pages. It’s about as dense as I can make it reasonably, and remains readable, if… unfriendly to those with older eyes.

It’s also worth noting that I’ve had trouble with 18 pages per envelope on two stamps. I randomly get some back (how one of five literally identical envelopes of material bounces is beyond me), or some arrive postage due. I’ve dropped to 15 sheets per envelope on two stamps, and haven’t had trouble. You can put 18-20 sheets in on three stamps without trouble too, though the envelope starts getting really thick. The right answer is probably a postal scale and “print your own postage” setup, if you’re intending to scale this substantially, but also, books of forever stamps aren’t a bad investment, with the rate of postal increases…
Bash It Up!
If you want to do this at scale, here you go! Drop this in a directory, run it, and wait - you should end up with nicely packed output files in the 4x2
directory!
#!/bin/bash
mkdir 4x2
for file in *.epub; do
prefix="${file%.*}"
ebook-convert "$file" "$prefix.pdf" --base-font-size 9 --custom-size 5.25x8 --pdf-page-numbers --pdf-page-margin-left 0 --pdf-page-margin-right 0 --pdf-page-margin-bottom 12 --pdf-page-margin-top 0 --minimum-line-height 100
pdfxup --paper letter --no-bb 1-4 -x 4 -y 2 -l 1 -o "4x2/${prefix}_4x2.pdf" "$prefix.pdf"
rm "${prefix}.pdf"
done
What About Background Colors?
This is all well and good, but what if you want to deal with something… older? Say, scans of some old shorthand guides?

The problem here is that background color. It doesn’t print well, and it’s quite hard to get rid of. There’s a tool that’s capable of doing this and many other useful things (OCRmyPDF
), except the behavior has been disabled for some while because… reasons.
Fortunately, someone has created a patch to re-enable the functionality! https://gist.github.com/Cyberes/8316c84bff1fe45f12ef2ae8d583e5b2 will help you out - build this, and you should have a tool that will work.
If it crashes complaining about existing OCR text in a page, just load the PDF in an editor, and “print to PDF.” This will remove all existing OCR data, and will give you a clean, image-only PDF to work with.

Auto-crop in the N-up tool seems to have trouble with the old scans as well - it really doesn’t do anything useful. Fortunately, Briss still exists, and you can slice and dice with that! For older content, be careful and expand out the margins some - a lot of it has pages here and there that aren’t exactly well aligned.
Run pdfxup
on the result of that, and you can work out something pretty darn useful to print out and send in. Is it perfect? Certainly not. Is it well packed and quite readable in terms of oddball little squiggles? Absolutely!

Again, this isn’t always the perfect method, but I’ve hammered out a lot of little quirks related to shipping things in, densely, to prison - as long as mail is allowed.
Adding Page Numbers
One thing you’ll run into, on occasion, is a lack of usable page numbers in PDFs. This can be from not having page numbers in the source material, or a tight crop to make things readable. However, if you want to add page numbers cpdf
(Coherent PDF) can do this easily enough for you!
cpdf -bottomright 20 -font Courier -add-text "Page \%Page / \%EndPage" in.pdf -o out.pdf
You can pick from a range of locations, though I find -bottom
and -bottomright
are the most useful. The number following is the offset distance, and you’ll want to push the page numbers as far in as you can without overwriting things, to allow the maximum page expansion. It’s pretty handy, and hopefully makes it far easier to arrange things in the right order. Seriously, try to send page numbers on anything that goes in…

Merging PDFs Into One Long File
Another useful thing to do is merge PDFs into one file. If you have a bunch of shorter documents and are compressing with pdfxup
, it’s easy to end up with a lot of extra whitespace on the pages. Merging short PDFs into one helps make the best use of envelope space, and this is super straightforward!
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=merged.pdf *.pdf
Route this into pdfxup
and things should look pretty darn good!
One way to get a lot of “short PDFs” is printing out webpages as PDF. The “Simplified” mode works pretty well for just pulling out text and most images, and spitting out reasonable PDFs to glob together and 4-up for shipping.
Dealing with Scanned Mail Delivery
Of course, not all places permit actual physical mail. Some places, to remove the need to actually deal with mail, just have you ship it somewhere that scans it, poorly, and delivers it digitally! Progress! Future! Remember how amazing Covid era lockdowns and digital-only everything were? Yeah. To deal with these, unfortunately, assume that your mail will be scanned by a lowest bidder contractor who does not care. Try to keep everything above about 9pt front (actual 9pt, not n-up scaled 9pt), and you really want page numbers on this stuff, because there’s no guarantee it will be scanned in anything resembling a reasonable order.
Seriously, if you can file lawsuits about this, go find a lawyer and do it. It’s beyond absurd.
Comments
Comments are handled on my Discourse forum - you'll need to create an account there to post comments.If you've found this post useful, insightful, or informative, why not support me on Ko-fi? And if you'd like to be notified of new posts (I post every two weeks), you can follow my blog via email! Of course, if you like RSS, I support that too.