Monday, November 2, 2015

Getting 8 pages from a US Letter page

This is one of those things where I'm sure the answer is clearly posted somewhere on the Internet... and I just really couldn't find it. So I'm typing up my solution here in the hopes that the next person who looks for the answer can more easily find it.

The problem was simple- I have a single piece of "normal" US Letter paper. I wanted to get 8 pages (4 per side) out of it. I also wanted the page to be part of a signature, which meant the layout of the pages wasn't just 1-4 on one side and 5-8 on the other. What am I printing? I'm printing a PDF of N pages. It happened to be generated by LaTeX but that shouldn't matter for this really.

So, how? Easy- use two command line tools pdf180 and pdfjam. The pdf180 command is required to flip the pages upside down so that they're right-side up when you do the first fold (which will later be cut open). pdfjam is required to correctly tile 4 pages per side of the paper so they're in the right order when you do the second (spine) fold.

That means a simple, single page would look something like this:
# assuming what you want to print is named MY_STORY.pdf
pdf180 MY_STORY.pdf --outfile TEMP_FLIPPED.pdf

pdfjam --nup 2x2 TEMP_FLIPPED.pdf '1,8' MY_STORY.pdf '4,5' TEMP_FLIPPED.pdf '7,2' MY_STORY '6,3' --outfile LAID_OUT_STORY.pdf

You now have a nicely laid out LAID_OUT_STORY.pdf to print and a TEMP_FLIPPED.pdf file you can delete.

That's all cool... but what if you're trying to print, say, a 445 page document? And you want to use 4 pieces of paper per signature for a total of 32 pages, front and back? That requires... PROGRAMMING! So I wrote a script which you can find over at my GitHub repo: There's also the 2 pieces of paper/16 pages total, front and back variant: If I were a not-lazy programmer I'd have written a single script that could dynamically take how many pages per signature. Oh well.

Disclaimer: the scripts don't handle missing pages at the end of your document. It does notify you if it's expecting blank pages, but what that really means is that it'll crash on the last pdfjam call. Just copy the command printed to the terminal and add in {}s instead of pages numbers that exceed your page limit. Again, if I were a not-lazy programmer I'd have written that in too, but bash scripting was... icky.

What this gets you is a new folder called output (careful! all content in existing output folder will get deleted!) filled with files temp_sig_1.pdf, temp_sig_16.pdf, temp_sig_32.pdf... etc, the number being the first page for that signature set.

So now you have as many files as you have signatures. That's obnoxious if you want to take a thumb drive to Office Max or something and have you print 3 copies of the book. So there's a second script called that you can run and it'll reach into the output directory and squish all the temp signature files into one file called book.pdf. And that is what you print.

Warning: if you go to the last page of the book.pdf, don't freak out that it doesn't have the last page of your original document! Remember, the signature is folded so the last printed pages will actually be some 6-12 away from the actual "end" of your book. I forgot this fact once and spent nearly 5 minutes having a heart attack thinking I had printed four copies of the wrong file.

Great! Now you have a stack of paper with your content printed on it! In the case of my 445 book that means 56 pages that need to be folded into 14 signatures.... and heaven forbid you get those pages out of order. Even with them being in order it takes a little bit of a mental warm up to ensure you fold them correctly. And so, here's an animated image and some basic steps to take in order to fold correctly:

  1. Ensure the lowest page number for the signature is in the upper left corner (upside down)
  2. Take page off of stack and place it "face" down, landscape. Lowest page number now lower right, face down in front of you.
  3. Hamburger fold the page, left side atop right. You can verify correctness by ensuring page numbers are consecutive inside the fold. Lowest page number still face down. Press edge with bone folder.
  4. Set aside. Repeat steps 1-3. You can be certain things are aligned correctly when the page number offsets of lower top page are 4 apart. They increase 4, 8, 12, 16, 20, 24, etc. Looking at the ones digit it's easy to follow the cycle -> 4,8,2,6,0,4
  5. On your 4th page stop. You'll know you're done with this signature set because after the hamburger fold in step 3 the to page should have consecutive pages. This is the middle of the signature.
  6. Use a knife to slice half the fold on each piece of paper- be consistent on which half you cut. Don't cut the rest of the fold until you're done with stitching the spine. If you're going to use a guillotine, just let it deal with the fold. Brace against something flat, fold, and press! VoilĂ ! Now you have a signature!

Final note: since I used LaTex, here is what my page geometry looked like for the original PDF generated:
     % due to the folded nature of my printouts, and the
     % failure to scale the paper correctly the bottom
     % and non-bound margins have extra space. The top
     % and the bound margin are expected to be the
     % specified offsets here.

That's what I printed. And things looked great! And then I stitched my 14 signatures together and some skew crept in. And then I used the guillotine and came within a hair's width of losing content on the top and bottom. I didn't! But it was waaaay to close for comfort. Will definitely be adding 5mm to the top and bottom margins next time around.

Final final note: I used \documentclass[10pt]{book}, \setlength{\parindent}{5mm}, and \setlength{\parskip}{4mm}. It's tiny, but legible. Definitely don't go smaller! A little larger would probably be nice but I couldn't afford to bump the book length any longer than it already was.

No comments:

Post a Comment