Tuesday, December 18, 2012

How to make an A5 sized booklet with A4 paper

Actually it is very easy to make an A4 sized booklet, and you can find this option even in some printer's settings..

With A4 sized booklet I mean printing the pages with A5 size, landscape, on A4 sheet so that if you take the printed papers and you fold in half you obtain a sort of book.

Actually it is a little bit harder to make a booklet with A5 paper.. and the main reason is that I do not have A5 paper..
Another reason is that in my opinion it is easier to print on A4 sheets without trouble (i.e. without feeding and paper alignment problems)

So here what I did:

  • take your pdf and convert to postscript: pdftops in.pdf out.ps
  • make a standard booklet ordered document: psbook out.ps outbook.ps
  • (here is the tricky part) insert two blank pages every two pages (this is explained later)
  • print to a new file, 4 pages per page (i did this because with evince i could not print double sided, but with other programs it added extra margins)
  • print this last document two sided, with the printer.. (eventually to save some paper you can print the first half pages (two sided), then turn the sheets and print the remaining pages on the other half of the sheets)
  • cut the pages and place them in the correct order

It sounds tricky but it is the simplest solution I found...

As you probably understood I inserted the blank pages to print only on the top half of each sheet.. this is necessary since I did not find a software able to order the pages for this kind of booklet.

To insert the blank pages I used two scripts:

#!/bin/bash
if [ $# -ne 3 ]
then
  echo "Usage example: ./pdfInsertBlankPageAt 5 src.pdf res.pdf"
  exit $E_BADARGS
else
  pdftk A=$2 B=blank.pdf cat A1-$(($1-1)) B1 A$1-end output $3
fi

require "optparse"
options = {:default => "args"}
ARGV.options do |opts|
opts.banner = "Usage:  #{File.basename($PROGRAM_NAME)} [OPTIONS] OTHER_ARGS"
opts.separator ""
opts.separator "Specific Options:"
opts.on( "-p pages", "--pages", Integer,
        "Num of pages" ) do |opt|
options[:pages] = opt
end
opts.separator "Common Options:"
opts.on( "-h", "--help",
        "Show this message." ) do
puts opts
exit
end
begin
opts.parse!
rescue
puts opts
exit
end
end
pdf = ARGV[0].chomp
range = (3..options[:pages]).step(2)
range.reverse_each do |pagenum|
%x{./pdfibpa #{pagenum} #{pdf} tmp#{pdf}}
%x{./pdfibpa #{pagenum} tmp#{pdf} #{pdf}}
end 

The first script is a shell script which inserts a page at a specified position. I named it pdfibpa.. I generated a blank page (blank.pdf) to do the trick..

The second script is a ruby script which adds two blank pages every two pages...

Maybe in the future I will build a simpler solution and publish a gem..

1 comment:

  1. They ought to likewise search for a printer that acknowledges short run supplement name printing to fit into unstable generation plans. Cheap Postcards EDDM

    ReplyDelete