2006/10/7, Tobias Burnus <burnus@net-b.de>:
Hello,

Using \combinepages[some-pdf][nx=3,ny=5], I get:

1  2  3
4  5  6
7  8  9
10 11 12

However, I'd like to get:
1  5  9
2  6 10
3  7 11
4  8 12

How can one achieve this? (I want to create again a poster out of talk.pdf.)

Tobias
 
Hi Tobias,
 
I can provide a first draft of a solution to your problem.
 
The frame around the combination should you show a small problem with my correction,
it is up to you change this and maybe to wikify this.
 

\unprotect

\startvariables            dutch                     english
                           german                    czech
                           italian                   romanian
                           french

               horizontal: horizontal                horizontal
                           horizontal                horizontal
                           horizontal                horizontal
                           horizontal

\stopvariables

\def\docombinepages[#1][#2]% a=perpag b=free
  {\bgroup
   \dontcomplain
   \getfiguredimensions[#1]%
   \getparameters
     [\??ip]
     [\c!alternative=\v!a,
      \c!n=\noffigurepages,\c!nx=2,\c!ny=2,\c!start=1,\c!stop=\!!maxcard,
      \c!distance=\bodyfontsize,
      \c!bottom=\vfill,\c!top=\vss,
      \c!left=\hss,\c!right=\hss,
      \c!before=\page,\c!after=\page,\c!inbetween=\blank,
      \c!frame=,\c!background=,\c!backgroundcolor=,
      \c!direction=\v!horizontal, % added
      #2]%
   \@@ipbefore
  %\doglobal\newcounter\combinedpagescounter
   \globallet\combinedpagescounter\@@ipstart
   \doifelse\@@ipalternative\v!b\!!doneafalse\!!doneatrue
   \if!!donea
    \doifelse\@@ipdirection\v!horizontal % added
     % loop for left to right and top to bottom combination
     {\doloop
       {\vbox to \textheight
           {\hsize\textwidth % ? ?
            \scratchdimen\@@ipdistance
            \!!widtha \dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax
            \!!heighta\dimexpr(\vsize-\@@ipny\scratchdimen+\scratchdimen)/\@@ipny\relax
            \dorecurse\@@ipny
              {\hbox to \hsize
                 {\dorecurse\@@ipnx
                    {\vbox to \!!heighta
                       {\hsize\!!widtha
                        \vsize\!!heighta
                        \@@iptop
                        \hbox to \hsize
                          {\@@ipleft
                           \ifnum\combinedpagescounter>\@@ipstop\relax
                             \globallet\@@ipn\!!zerocount
                           \else\ifnum\combinedpagescounter>\@@ipn \else
                             \externalfigure[#1]
                               [\c!object=\v!no,
                                \c!page=\combinedpagescounter,
                                \c!factor=\v!max,
                                \c!background=\@@ipbackground,
                                \c!backgroundcolor=\@@ipbackgroundcolor,
                                \c!frame=\@@ipframe]%
                           \fi\fi
                           \@@ipright}
                        \@@ipbottom}%
                     \doglobal\increment\combinedpagescounter
                     \hfil}%
                  \hfilneg}
               \vfil}%
           \vfilneg}%
           \page
        \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}}
     % loop for top to bottom and left to right combination
     {\doloop
       {\vbox %to \textheight
         {\hsize\textwidth
          \scratchdimen\@@ipdistance
          \!!widtha \dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax
          \!!heighta\dimexpr(\vsize-\@@ipny\scratchdimen+\scratchdimen)/\@@ipny\relax
          \hbox to \hsize
           {\dorecurse\@@ipnx
              {\@@ipleft
               \vbox to \textheight
                 {\hsize\!!widtha
                   {\dorecurse\@@ipny
                       {\@@iptop
                        \hbox to \hsize
                          {\vbox to \!!heighta
                            {\hsize\!!widtha
                             \vsize\!!heighta
                             \ifnum\combinedpagescounter>\@@ipstop\relax
                               \globallet\@@ipn\!!zerocount
                             \else\ifnum\combinedpagescounter>\@@ipn \else
                               \externalfigure[#1]
                                 [\c!object=\v!no,
                                  \c!page=\combinedpagescounter,
                                  \c!factor=\v!max,
                                  \c!background=\@@ipbackground,
                                  \c!backgroundcolor=\@@ipbackgroundcolor,
                                  \c!frame=\@@ipframe]%
                             \fi\fi}}
                        \doglobal\increment\combinedpagescounter
                        \@@ipbottom}%
                     %\doglobal\increment\combinedpagescounter
                     \vfil}%
                  \vfilneg}
               \hfil}%
           \hfilneg}}
           \page
        \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}}
   \else
     \doloop
       {\startbaselinecorrection
          \scratchdimen\@@ipdistance
          \!!widtha\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax
          \hbox to \hsize
            {\dorecurse\@@ipnx
               {\doglobal\increment\combinedpagescounter
                \ifnum\combinedpagescounter>\@@ipn \else
                   \expanded{\externalfigure[#1]
                     [\c!page=\combinedpagescounter,
                      \c!width=\the\!!widtha,% todo \freezedimenmacro
                      \c!background=\@@ipbackground,
                      \c!backgroundcolor=\@@ipbackgroundcolor,
                      \c!frame=\@@ipframe]}%
                   \hfill
                \fi}\hfillneg}%
        \stopbaselinecorrection
        \ifnum\combinedpagescounter<\@@ipn\relax
          \@@ipinbetween
        \else
          \exitloop
        \fi}
   \fi
   \@@ipafter
   \egroup}

\protect

\starttext

\framed{\combinepages[your-pdf][nx=4,ny=6,direction=vertical]}

\framed{\combinepages[your-pdf][nx=4,ny=6]}

\stoptext

Wolfgang