2

I have a document, 78 pages long formatted into a6 paper size. I need to print those pages onto a4 sized paper, double sided.

SAMPLE LAYOUT BEGINS: https://i.sstatic.net/rIyGB.png SAMPLE LAYOUT ENDS

EDIT 2 begins:

In this way, if each of the 78 pages can be printed on both sides of an A4 paper, I can fold, cut and stack many such sheets (which are now in A6 size) and bind them together. This is my idea. NOTE: (inv) means inverted.

Another Question: What should be done to implement signatures in these A4-turned-into-A6 books? In the case of A5 books, that is very easy.

EDIT 2 ends

I went through the following links:

  1. Print eight A6 pages on one two-sided A4 sheet in a book folding order

  2. Print A6 book on A4 double-sided in correct order

  3. Duplicate A6 booklets on A4 paper

EDIT BEGINS

  1. Links (1) and (3) discuss about printing "duplicate" A6 pages on both sides of an A4 page. But I need a solution for printing a singular A6 book of 78 pages on A4 paper "Both sides".

  2. Link (2): More closer to my need. But only "eight" A6 pages are considered. How can I extend the code to 78 pages?

I'm not sure if the solution posted by @AndrewStacey in Print A6 book on A4 double-sided in correct order can be used for a bigger book also. If he or someone can clarify this point, it will be nice. It will also be nice if the code provided in the answer of Print A6 book on A4 double-sided in correct order be commented/explained in detail so that anyone can follow it. Example Doubt: I am not able to understand where I should specify my A6 PDF file in the code.

EDIT ENDS

I have made the following MWE that achieves the desired result for 1-sided printing. But how can we achieve 2-sided printing so that I can later cut, fold and bind the pages to form a A6 sized book?

\documentclass[a4paper]{article}
\usepackage[pdftex]{color,graphicx,epsfig}
\usepackage[margin=0in]{geometry}
\usepackage[final]{pdfpages}
\begin{document}
\includepdf[pages=-,nup=2x2,landscape=false,frame,noautoscale=true]{a6sized-doc.pdf}
\end{document}

Please edit my question/tages for clarity.

7
  • 2
    pgfmorepages can certainly do this. I don't know if any of the existing layouts will suit, but it isn't difficult to define new ones. Can you add a schematic of how you'd want the a6 pages laid out on the a4? Commented Mar 29, 2022 at 5:45
  • @AndrewStacey: Please see my edits.
    – vrgovinda
    Commented Mar 29, 2022 at 11:53
  • 1
    It's still not clear to me how you want the pages laid out. The 8 on 2 format can cope with any number of pages, but I can't tell if the eventual layout is correct as you haven't specified the order you want. Commented Mar 29, 2022 at 21:24
  • Certainly not an answer but a column I wrote for TUGboat described various means of printing pages in unexpected, but useful, ordering tug.org/TUGboat/tb31-3/tb99glister'pdf. It may be useful in other contexts. Commented Mar 30, 2022 at 17:46
  • This is not an answer, far be it. Some years ago I wrote a column for TUGboat that dealt with laying out (up to 16) pages, in various configurations, on a single sheet. Perhaps it might be of interest: tug.org/TUGboat/tb31-3/tb99glister.pdf Commented Mar 30, 2022 at 17:56

3 Answers 3

3

Here's an adaptation of the answer given at Print A6 book on A4 double-sided in correct order. It changes the order and turns the required pages upside-down. Each set of 8 pages gets printed onto two pages according to the specified layout. The code is meant to be put into the preamble of the original document (in place of all the \dopage stuff in the below), so there's only one tex document here.

\documentclass{article}
%\url{https://tex.stackexchange.com/q/638802/86}
%Adapted from \url{http://tex.stackexchange.com/q/279042/86}
\usepackage{pgfmorepages}

\pgfpagesdeclarelayout{8 on 2, book format}
{%
  \edef\pgfpageoptionheight{\the\paperheight}
  \edef\pgfpageoptionwidth{\the\paperwidth}
  \def\pgfpageoptionborder{0pt}
  \def\pgfpageoptionfirstshipout{1}
}%
{%
  \pgfpagesphysicalpageoptions
  {%
    logical pages=8,%
    physical pages=2,%
    physical height=\pgfpageoptionheight,%
    physical width=\pgfpageoptionwidth,%
    current logical shipout=\pgfpageoptionfirstshipout%
  }
  \pgfpagesphysicalpage{1}{}
    \pgfpageslogicalpageoptions{1}
  {%
    rotation=180,
      border shrink=\pgfpageoptionborder,%
      resized width=.5\pgfphysicalwidth,%
      resized height=.5\pgfphysicalheight,%
      center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}%
    }%
    \pgfpageslogicalpageoptions{8}
  {%
    rotation=180,
      border shrink=\pgfpageoptionborder,%
      resized width=.5\pgfphysicalwidth,%
      resized height=.5\pgfphysicalheight,%
      center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}%
    }%
    \pgfpageslogicalpageoptions{4}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.5\pgfphysicalwidth,%
      resized height=.5\pgfphysicalheight,%
      center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight},%
    }%
    \pgfpageslogicalpageoptions{5}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.5\pgfphysicalwidth,%
      resized height=.5\pgfphysicalheight,%
      center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight},%
    }%
  \pgfpagesphysicalpage{2}{}
    \pgfpageslogicalpageoptions{7}
    {%
      rotation=180,
      border shrink=\pgfpageoptionborder,%
      resized width=.5\pgfphysicalwidth,%
      resized height=.5\pgfphysicalheight,%
      center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}%
    }%
    \pgfpageslogicalpageoptions{2}
    {%
      rotation=180,
      border shrink=\pgfpageoptionborder,%
      resized width=.5\pgfphysicalwidth,%
      resized height=.5\pgfphysicalheight,%
      center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}%
    }%
    \pgfpageslogicalpageoptions{6}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.5\pgfphysicalwidth,%
      resized height=.5\pgfphysicalheight,%
      center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight},%
    }%
    \pgfpageslogicalpageoptions{3}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.5\pgfphysicalwidth,%
      resized height=.5\pgfphysicalheight,%
      center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight},%
    }%
}


\pgfpagesuselayout{8 on 2, book format}

\newcommand\dopage{%
\noindent\resizebox{.99\linewidth}{!}{Page \thepage}
  \newpage}

\begin{document}
% The document goes here
\dopage\dopage
\dopage\dopage
\dopage\dopage
\dopage\dopage
\dopage\dopage
\dopage\dopage
\dopage\dopage
\dopage\dopage
\end{document}

First page Second page Third page Fourth page

(The different sizes of the text is due to the fact that on each page it is resized to the width of the page, but then that means that Page 1 and Page 11 resize by different scale factors.)

1
2

Edit I may have misunderstood the OPs intention and John Kormylo's answer is probably what is looked for. My intention was to print all the sheets, then fold them all together (not one after another), then staple and cut. If you have more than a very few sheets of paper, folding them together twice becomes quite cumbersome... so I let this answer just for posterity. At least, it was fun finding the algorithm :)

Edit 2: I guess I was a bit tired when I wrote my edit. My solution does indeed work if you fold each sheet once individually (horizontal fold), then stack them, bind them, and do the vertical fold after it. If you have a guillotine cutter, cut 1mm (or even less if you can) at the top, and you have your a6 booklet done.

The other answers work if you do both folds for each sheet of paper individually, then stack them with the first on the left and the last on the right. In this case, after binding, it doesn't look like a regular booklet though.

If you have for example 32 pages on 4 sheets of paper, my answer gives you a booklet of this form:

enter image description here

the others of this form:

enter image description here

Answer:

enter image description here

If this is what you're looking for, here is how I obtained it.

I produced the 78-page pdf (called numbered-pages.pdf) with:

\documentclass[a6paper]{article}

\usepackage{pgffor,graphicx}
\pagestyle{empty}
\begin{document}
\foreach \p in {1,...,78}
{
\vspace*{\stretch{1}}


{\centering\resizebox{!}{7cm}{\p}\par}

\vspace*{\stretch{1}}
\newpage
}
\end{document}

Then, I wrote a perl script in order to find the needed reordering of the 78 pages, including which ones should be rotated. I adapted the output to fit the format of the pdftk tool.


#!/usr/bin/perl
use strict; 
exit if $#ARGV != 0;
my $total = $ARGV[0];
my $arrondi = $total;
if ($total%8) {$arrondi+=8-$total%8;}

exit if ($total < 1);

my $feuilles = $arrondi/8;

my $liste = "";

for (my $i=0; $i<$feuilles;$i++)
{
  my $init = $i * 4 + 1;
  my $final = $arrondi - $i * 4;

  foreach my $page 
       ($init,
        $final,
        $init+3,
        $final-3,
        $final-1,
        $init+1,
        $final-2,
        $init+2,)
  {
    if ($page > $total){$liste .= "E ";}
    elsif ($page == $init or $page == $final or $page == ($init+1) or $page == ($final -1))
    {$liste .= 'A'.$page.'south ';}
    else
    {$liste .= 'A'.$page.' ';}
  }
}
$liste .= "\n";
print $liste;

Call the script 8on2book.pl and ask for

$ 8on2book.pl 78

if you have 78 pages, which outputs

A1south E A4 A77 E A2south A78 A3 A5south A76south A8 A73 A75south A6south A74 A7 A9south A72south A12 A69 A71south A10south A70 A11 A13south A68south A16 A65 A67south A14south A66 A15 A17south A64south A20 A61 A63south A18south A62 A19 A21south A60south A24 A57 A59south A22south A58 A23 A25south A56south A28 A53 A55south A26south A54 A27 A29south A52south A32 A49 A51south A30south A50 A31 A33south A48south A36 A45 A47south A34south A46 A35 A37south A44south A40 A41 A43south A38south A42 A39 

Integrate it in the command line for pdftk like this. It needs a 1-page blank pdf-file in the same directory (called page-blanche.pdf).

$ pdftk A=numbered-pages.pdf E=page-blanche.pdf cat A1south E A4 A77 E A2south A78 A3 A5south A76south A8 A73 A75south A6south A74 A7 A9south A72south A12 A69 A71south A10south A70 A11 A13south A68south A16 A65 A67south A14south A66 A15 A17south A64south A20 A61 A63south A18south A62 A19 A21south A60south A24 A57 A59south A22south A58 A23 A25south A56south A28 A53 A55south A26south A54 A27 A29south A52south A32 A49 A51south A30south A50 A31 A33south A48south A36 A45 A47south A34south A46 A35 A37south A44south A40 A41 A43south A38south A42 A39 output 8on2-ordered-pages.pdf

This gives you 80 reordered and rotated pages, called 8on2-ordered-pages.pdf, ready to print 4 on 1 double-sided.

Now, you may ask your printer to print 4 on 1 if your printing interface has this option (beware, it often adds margins between the pages and on the borders, so use this possibility with care).

Otherwise, use pdfpages to produce the final 4 on 1 pdf to be then printed two-sided:

\documentclass[a4paper]{article}

\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-,nup=2x2]{8on2-ordered-pages.pdf}
\end{document}

I let as an exercise for the reader to pack this all in a script. The core is the algorithm in the perl script. In the other answers and the linked questions and answers, the point is not tackled. For instance, for 8 pages, the order is 1 8 4 5 7 2 6 3, but for 16 pages, it's not 1 8 4 5 7 2 6 3 9 16 12 13 15 10 14 11, but 1 16 4 13 15 2 14 3 5 12 8 9 11 6 10 7. In the other answers, the problem with more than 8 pages in tackled differently, see my edit at the top of this answer.

If pdfpages could rotate pages (or can it?), it would be a good solution too, also because it can create empty pages on the fly, which pdftk can't do.

1
  • Thanks @benjamin. I think your solution gives a booklet. But I am interested in using signatures since they are easy to staple and bind. But your solution is interesting, so I'll upvote it.
    – vrgovinda
    Commented Apr 2, 2022 at 13:41
2

This assumes you want 8 consecutive a6 pages in each folded a4 page, as opposed to cutting, stacking and stapling the whole document together (magazine style). Not sure what you want the a4 cover for, but the easiest solution is to simply add the a4 pages here before and after the loop.

\documentclass[a4paper]{article}
\usepackage[margin=0in,noheadfoot]{geometry}
\usepackage[export]{adjustbox}
\usepackage{color,graphicx,epsfig}
\pagestyle{empty}% off page anyway
\parindent=0pt

\newcommand{\filename}{test7}
\newcounter{pzero}

\begin{document}
\loop \ifnum\value{pzero}<24\relax% number of pages
  \includegraphics[page={\numexpr\value{pzero}+1},rotate=180,origin=c]{\filename}%
  \includegraphics[page={\numexpr\value{pzero}+8},rotate=180,origin=c]{\filename}\par
  \includegraphics[page={\numexpr\value{pzero}+4}]{\filename}%
  \includegraphics[page={\numexpr\value{pzero}+5}]{\filename}\par
  \includegraphics[page={\numexpr\value{pzero}+7},rotate=180,origin=c]{\filename}%
  \includegraphics[page={\numexpr\value{pzero}+2},rotate=180,origin=c]{\filename}\par
  \includegraphics[page={\numexpr\value{pzero}+6}]{\filename}%
  \includegraphics[page={\numexpr\value{pzero}+3}]{\filename}\par
  \addtocounter{pzero}{8}%
\repeat
\end{document}

Test7.pdf was created using

\documentclass{article}
\usepackage[a6paper]{geometry}
\usepackage{lipsum}
\begin{document}
\lipsum[1-42]
\end{document}

In my original solution, if the number of pages was not a multiple of 8, the extra pages would show up in the middle. This version works from the middle out.

The extra pages can show up at the beginning or end or both, depending on how you chose the middle page. Note that an odd middle page will reverse the left/right properties of even/odd pages.

\documentclass[a4paper]{article}
\usepackage[margin=0in,noheadfoot]{geometry}
\usepackage[pdftex]{color,graphicx,epsfig}
\usepackage{paracol}

\pagestyle{empty}% off page anyway
\parindent=0pt
\newcommand{\filename}{test7}
\newcounter{plow}
\newcounter{phigh}
\setcounter{plow}{12}% middle page (even)
\setcounter{phigh}{\value{plow}}
\newcommand{\pmax}{23}% last page
\globalcounter*
\columnsep=0pt

\begin{document}
\begin{paracol}[2]{4}
\loop \ifnum\value{plow}>0
    \includegraphics[page=\value{plow}]{\filename}
    \addtocounter{plow}{-1}%
  \else
    \vspace*{0.5\textheight}
  \fi
  \switchcolumn
  \ifnum\value{phigh}<\pmax\relax
    \stepcounter{phigh}%
    \includegraphics[page=\value{phigh}]{\filename}
  \else
    \vspace*{0.5\textheight}
  \fi
  \switchcolumn
  \ifnum\value{phigh}<\pmax\relax
    \stepcounter{phigh}%
    \includegraphics[page=\value{phigh}]{\filename}
  \else
    \vspace*{0.5\textheight}
  \fi
  \switchcolumn
  \ifnum\value{plow}>0
    \includegraphics[page=\value{plow}]{\filename}
    \addtocounter{plow}{-1}%
  \else
    \vspace*{0.5\textheight}
  \fi
  \switchcolumn
\ifnum\pmax>\numexpr\value{phigh}-\value{plow}\relax\repeat
\end{paracol}
\end{document}
7
  • Your code is getting compiled. DOUBTS: 1. Are the pages getting scaled? 2. Are you adding extra space between the A6 pages in the final A4 page? I ask this because the final content on the A4 page look shrinked. But this is just my observation. I haven't printed them out to physically check out.
    – vrgovinda
    Commented Mar 31, 2022 at 8:58
  • Also, the pages on the A4 sheet aren't inverted anywhere. When we fold and cut them to obtain the final A6 book, I think that some pages will be inverted.
    – vrgovinda
    Commented Mar 31, 2022 at 9:02
  • I mean to say that when we print on both sides of the A4 paper, shouldn't some pages of the A6 be inverted so that they turn up properly after the folding and cutting episode?
    – vrgovinda
    Commented Mar 31, 2022 at 9:50
  • Complete replacement based on edited question. Commented Mar 31, 2022 at 15:56
  • Does your new code shrink the A6 pages?
    – vrgovinda
    Commented Apr 2, 2022 at 13:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .