I kept running into small workflow needs that fall outside what the compiler is meant to do. The most common one for me was printing a document as a booklet: fold a stack of double-sided pages in half and have it read in order. That’s a page-imposition problem, so it makes sense the compiler doesn’t handle it (see e.g. typst#5092) but I still needed it, so I built a small command-line tool to sit after compilation and handle it.
typst-post works on the compiled PDF directly (or your source tree, for the packing command), using vector transformations only, nothing gets rasterized, and text layers and links stay intact.
It does four things:
booklet — impose pages as a 2-up saddle-stitch booklet, with sheet scaling and signature grouping for thicker bindings
rotate — rotate individual pages or ranges by 90/180/270 degrees
reorder — reorder, duplicate, or drop pages from a page list
pack — zip a project together with every file it actually depends on, using the compiler’s own --deps output rather than guessing from source text
Personally I would use typst-post when you’ve implemented 4-up printing. My booklets are such that four pages print on one side of a letter sheet of paper and four more print on the other side of the paper sheet. That’s my signature size. Then another signature will include the next 8 logical pages. This repeats until all 8N logical pages are printed, hopefully with no empty pages at the end, but not necessarily. Then I take each signature sheet and fold/cut the paper and stack it it with each other signature to assemble the booklet.
Frankly it’s magical when the imposition software works sensibly and I can figure out the order in which to fold and cut the signatures.
Thank you, this is exactly the kind of case I was hoping to hear about.
What you’re describing is different from what booklet does now. Each sheet is its own 8-page signature, folded independently, then gathered with the others. Right now booklet does 2-up spreads with --signature just grouping sheets for nesting. Different layout, different rotation pattern per page.
My ability to describe the proper folding and cutting order is limited as I have difficulty visualizing the process.
So I did find a PDF I made a while back using some hard-to-use imposition tool long forgotten that gives the ordering I’ve come to be somewhat familiar with. I’ve saved it at Imposition-Example. I print this double-sided and then figure out the folding cutting order from there.
Thanks for digging that up by the way! That’s exactly what I needed. I was able to work out the full page position and rotation pattern directly from the file, verified against every sheet. On the list now.
Update: built this out. typst-post booklet chapbook.pdf --layout 4up --signature 16
@Johannes_Rexx I worked out the page position and rotation pattern directly from the file you shared, and checked it against every quadrant of every sheet, so it should match what you’re used to. But I’d really like to know if it holds up for you in practice. Real print/fold/cut is a better test than anything I can verify on my end. No rush, whenever you get a chance.