KitzKikz  KitzKikz: PdfTonto   RecentChanges 
 PopularPages 
 SearchPages 
 Home | Trail - PdfTonto
 
 

I'm not finished with the introductory text yet, so here is some filler Lipsum.
Scroll down to get the full documentation.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam sagittis elit ac mi. Donec faucibus lectus ut lectus. Sed tempus odio eget metus. Morbi congue blandit magna. Cras neque nibh, cursus eget, vulputate sit amet, cursus sed, mauris. Phasellus lorem. Sed consectetuer adipiscing lorem. Proin lectus nisi, auctor vitae, porttitor ac, elementum quis, tellus.

Ut eu odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque rhoncus aliquam orci. Cras dignissim nulla eu enim. Etiam diam. Maecenas neque. Mauris quis massa. Fusce lobortis lectus et nulla. Aenean felis pede, pellentesque vel, vehicula vel, pretium non, risus. Vivamus odio lorem, placerat ac, consectetuer ut, aliquet vitae, libero. Quisque blandit sodales nisl. Nunc ac odio.

In hendrerit. Vivamus sed nisi sit amet massa porta viverra. Praesent tempus laoreet ante. Integer eget odio. Phasellus a diam non nulla rutrum varius. Nulla facilisi. In eu ligula. Nunc placerat mauris condimentum magna. Nullam eget pede at magna mollis sagittis. Cras egestas arcu quis erat.

Platforms

  • Any that can run perl programs.
  • Tested successfully on Mac OS X & Linux

Requirements

  • Perl 5+
  • Ability to use command line interface  
 

Download
Manual Page
PdfTontoFAQ
PdfTontoIssues
History

 

 

NAME  

pdfTonto - Arrange pages of a PDF for easier printing of books

SYNOPSIS  

pdfTonto [options] < input.pdf > out.pdf

Required Options (at least one is required):
--pages page-list : List of pages to extract
--filter name : Arrangement filter to use

Other Options:
--in filename : Get input from filename instead of standard in
--out filename : Write to filename instead of standard out
--sig N : Signature size. Only used by some filters
--help, -? : Display more help info
--man : Display full man page

DESCRIPTION  

Extracts a given set of pages from a pdf and rearranges them in an order useful for printing in a book format.

Pages can be arranged for easy folding of a 2-up layout to make booklets.

Pages can be arranged for cutting the 2-up layout in the middle and placing one half on top of the other without the need for hand collating.

Print the front side or the back side independently, for printers that can't print on both sides of the paper. The back side can be printed in reverse order if needed.

OPTIONS  

--pages page-list, -p page-list
The list of pages to extract from the input PDF. Use commas to separate pages or ranges and use a dash to specify a range (i.e. 1,3,6-12). Pages can be put in any order and can even be repeated (i.e. 15,30,17,7,17,0). Use page number zero to put a blank page in that position. If the --pages option is not used, then all pages in the input PDF will be passed to the --filter. Either one or both of --filter and --pages must be used.

--filter name, -f name
The filter to use on the extracted pages to rearrange them for printing. See the man page for a list of existing filters and their explanations. If the --filter option is not used, then pages are written to the output PDF in the exact order given in the --pages option. Either one or both of --filter and --pages must be used.

--in filename, -i filename
The PDF file to use as the source. Defaults to the standard input if not specified.

--out filename, -o filename
The PDF file to write the results to. Defaults to the standard output if not specified. Will overwrite the file if it exists.

--sig N
Specify the number N of sheets that make up a signature (sub-book let) for filters that support them. Defaults to no signatures. Signatures is a technique useful for binding books larger than a few dozen pages.

--help, -?, --man
View the help text

FILTERS  

booklet
For 2-up layout printing. Arranges pages so that the sheets can be folded and proper page order is maintained. Supports the --sig option. For booklets of more than a few dozen pages, signatures are recommended.

booklet_front
Same as booklet, but only outputs pages for the front side of each sheet. Use for 2-up printing on printers that only print on one side of the paper.

booklet_back
Same as booklet, but only outputs pages for the back side of each sheet. Use for 2-up printing on printers that only print on one side of the paper. Depending on how the printer outputs sheets, booklet_back_reverse may be needed instead.

booklet_back_reverse
Same as booklet_back, but prints in reverse sheet order.

slice_stack
slice_stack_front
slice_stack_back
slice_stack_back_reverse
For 2-up layout printing. Arranges pages so that the entire stack can be sliced in half, the left stack can be placed on top of the right stack, and all the pages will be in order. If the printer does not support printing on both sides of the paper, use the front, back, and back_reverse variants.

4up_front
4up_back
4up_back_reverse
For 4-up layout printing. Useful if the target printer doesn't duplex (print on both sides). First use 4up_front to print, then turn the stack over and feed it through again using either 4up_back or 4up_back_reverse (depending on how the printer outputs the paper).

EXAMPLES  

Capturing a range of pages from a larger PDF and sending them as a booklet directly to a printer using CUPS. The printer supports 2-up layout and printing on both sides:
       pdfTonto -i in.pdf -p 34-86 -f booklet | \
       lp -d printer-name -o sides=two-sided-short-edge -o number-up=2
Using the same range of pages in booklet form, but sending them to a printer that can only handle single sided printing. This will require two passes of the paper through the printer:
       pdfTonto -i in.pdf -p 34-86 -f booklet_front | \
       lp -d printer-name -o number-up=2
       pdfTonto -i in.pdf -p 34-86 -f booklet_back | \
       lp -d printer-name -o number-up=2
Save the page range in slicestack form so you can take the PDF to work and print it on a high quality duplex printer, use the large vertical paper cutter to trim the pages, and use the plastic-comb binding machine to put them all together in a nice book. What? Don't you have those where you work?
       pdfTonto -i in.pdf -p 34-86 -f slicestack -o out.pdf

CAVEATS  

N-up Printing
pdfTonto does not actually resize, rotate, and combine multiple input pages onto a single output page. It only reorders the pages so that they'll come out of the printer correctly for binding into a book. Your printer and driver still need to print in 2-up or 4-up mode. If your printer does not support N-up printing, then you have bigger problems than reordering the pages of a PDF.

File Size
pdfTonto takes advantage of the "Incremental Update" feature of Adobe's PDF Specification. It only writes the new page directory to the end of the file. This is a much faster method than rewriting the entire PDF from scratch. This also means that the output PDF file will not reduce in size, even if you are sampling 10 pages out of a 1200 page PDF.

If you need to have a smaller file (so it will fit on a flash drive, for example), open the output PDF in a viewing program, such as Preview in Mac OS X, and use "Save As..." to create a new copy. The program will rewrite the PDF from scratch, omitting any data not referenced by the page directory created by pdfTonto.

RESTRICTIONS  

This script will not read PDF's containing Cross Reference Streams added at version 1.5 of Adobe's PDF Specification. If there is enough demand for it, I may look into adding that additional feature.

For the few PDF's I've come across using Object Streams, I simply opened them in a viewing application (Mac OS X Preview) and chose "Save as...", which rewrote the PDF in a format without the compressed streams. I then used pdfTonto on that second PDF with no troubles.

pdfTonto will not work with encrypted PDF files.

NOTES  

A Tonto is a type of Japanese knife or dagger. Tonto also means "idiot" in Spanish. Either one of these could explain the name "pdfTonto". However, I originally wanted to call this "pdfArranger", but that was too close to a couple of other programs out there. So, the thought process went like this:

pdfArranger...A Ranger...Lone Ranger...Tonto...pdfTonto

Now you'll never forget it, Kemo Sabe :-)

 

NAME
SYNOPSIS
OPTIONS
FILTERS
EXAMPLES
CAVEATS
RESTRICTIONS
NOTES

 

 

Version History  

Version 1.1
Outputs a blank page for requests that are outside the page range of the input PDF.
This would have created an unreadable PDF otherwise.
Version 1.0
Initial Version

 

   

 
 EditThisPage · LinksToPage · PageInfo 01/03/06 10:32:49  ·  0.0527s