3

I have a RTL (right-to-left) pdf document and want to print it in booklet format so that it could be printed double sided and binded as a book. There is simple solutions for LTR (left-to-right) documents, such as pdfbook:

pdfbook inputfile.pdf

above simple command will create a new pdf file named inputfile-book.pdf that could be printed double sided (duples printed "Long edge").

Is there a similar solution for right to left documents?

muru
  • 193,181
  • 53
  • 473
  • 722
PHP Learner
  • 2,698
  • 9
  • 29
  • 48

2 Answers2

2

I foungI found a wokaround for this problem:

for 16 pages input file:

pdfbook --signature* 4 inputfile.pdf 16,15,14,13,6,5,8,7,10,9,12,11,4,3,2,1 --outfile book-RTL.pdf

for 14 pages input file:

pdfbook --signature* 4 inputfile.pdf {},{},14,13,6,5,8,7,10,9,12,11,4,3,2,1 --outfile book-RTL.pdf

for 12 pages input file:

pdfbook --signature* 4 inputfile.pdf 12,11,4,3,6,5,8,7,10,9,2,1 --outfile book-RTL.pdf

for 10 pages input file:

pdfbook --signature* 4 inputfile.pdf {},{},4,3,6,5,8,7,10,9,2,1 --outfile book-RTL.pdf

for 8 pages input file:

pdfbook --signature* 4 inputfile.pdf 2,1,4,3,6,5,8,7 --outfile book-RTL.pdf
PHP Learner
  • 2,698
  • 9
  • 29
  • 48
  • this was very useful, but in order to get it to print the booklet RTL, I had to remove the asterisk after --signature. Also, where can I find more information about the number order that you used. – Menachem Dec 21 '21 at 00:08
0

PHP Learner's answer worked, but I looked for another solution for several reasons. [These reasons include: pdfbook is no longer officially supported by the developers; I had to remove the asterisk in the signature switch in order to get it to do RTL; The workarounds given in that answer were only for specific numbered booklets, and I couldn't figure out how the numbering system worked, to extrapolate to other sized booklets]

Here's the solution using pdfjam:

pdfjam --booklet 'true' --paper 'letter' --suffix 'book' --landscape --signature* '4' 'inputfile.pdf' --outfile ./

To break down the command:

pdfjam == pdfjam is the engine behind the pdfbook script (pdfjam itself is a shell-script interface to the "pdfpages" LaTeX package)

--booklet 'true' == this is what makes pdfjam print the pdf as a booklet, as opposed to all the pages in order (this is a key value for '\includepdfmerge', in the LaTeX 'pdfpages' package)

--paper 'letter' == pdfjam uses A4 by default, this will tell it to use 8.5x11 size paper

--suffix 'book' == this will automatically add the suffix '-book.pdf' to the inputfile name to create the output file name. In order for this to work, the output file must be a directory

--landscape == make the booklet go along the long side of the page

--signature* '4' == 4 pages on a single doublesided page. The asterisk reverses the order of the pages, giving an RTL booklet

'inputfile.pdf' == path to input file

--outfile ./ == when a directory is used, the file name will be $inputfile-book.pdf (since we chose book as the suffix earlier. A regular pdf filename can also be used here.)

Menachem
  • 876
  • 2
  • 8
  • 19