mkbooklet – prepare PDF files for booklet printing

mkbooklet (on GitHub) takes as input a PDF file and creates an A4 paper output PDF file ready for booklet (long-edge, duplex) printing. In addition, it minimizes margins on the outer edges in order to waste as little printable space as possible, even in situations where pdfcrop tends to fail or if the pages actually consist of scanned—i.e., rasterized—imagery. Optionally, mkbooklet can add folding (or cutting) and stapling guides to the final output file.

Alternatively, mkbooklet can be used to generate a PDF file of single A5 pages ready for A5 printing and binding.

Example

Input and Output.

Example input document
Example output document

Usage

$ mkbooklet fulltext.pdf

$ mkbooklet --help

Note: this program works best if page scaling/shrinking/fitting is disabled when sending the document to the printer, assuming it runs on A4 paper.

Installation and Requirements

mkbooklet is written in Python and can be installed through pip.

pip install git+git://github.com/pb-/mkbooklet.git

Running mkbooklet requires Ghostscript (gs) and a LaTeX compiler that produces PDF output. By default mkbooklet will try pdflatex but you can override this by setting the MKB_TEXCOMP environment variable to the compiler of your choice.

Documentation

Without any options, mkbooklet will most likely just do the right thing (for me, at least), but there are quite a few options to play around with.

-5, --a5
Instead of outputting 2up (two-on-one) A4 pages, produce 1up (one-on-one) A5 output. Useful if the printer itself directly processes A5 paper.
-b BBOX, --bbox BBOX
Use BBOX for the bounding box, specified either as x1,y1,x2,y2 or x,y+w,h where all values are assumed to be integer postscript points.
-C, --croponly
Only crop the input file and produce A4 output pages, good for screen reading.
-c, --nocrop
Do not crop the input file, leaving original margins fully intact (modulo scaling).
-e PAGES, --extrapages PAGES
Add at least PAGES additional blank pages for notes to the end of the document.
-g, --noguides
Do not add stapling guides to the title page.
-h, --help
Show help message.
-i MARGIN, --inner-margins MARGIN
Use MARGIN millimeters for the inner margin of the paper, i.e., the margin between the content and the folding edge. This is only a lower bound because, depending on the aspect ratio of the content, mkbooklet will move the contents to the outer edges of the paper.
-l, --longarm
Apply long-arm stapling guides.
-o MARGIN, --outer-margins MARGIN
Use MARGIN millimeters for the outer margins of the paper. This includes the left/right outer (non-folding) side as well as top and bottom margins. Since the content is placed as far away as possible from the folding edge, the value is only a lower bound for top and bottom margins, depending on the aspect ratio of the content.
-p PAGE, --bboxpage PAGE
Obtain the bounding box for the entire document from PAGE only.
-S, --signature NUM
Create signatures consisting of NUM sheets instead of one large one; the last signature may have less than NUM sheets. Note that this requires short-edge printing instead of long edge.
-s, --smartbbox
Instead of taking the maximum over the document when determining the bounding box, use the median on each margin seperately. Very useful for poorly typeset documents that contain overfull lines on some of the pages.
--version
Display current version.

Back to my homepage.