Is there an easy way to put two single pdf pages side by side in a single pdf page?

1250 views
Skip to first unread message

Peng Yu

unread,
Apr 11, 2010, 4:00:21 PM4/11/10
to
I have a number of pairs of pdf pages. The pdf pages in each pair are
of the same height or same width. I want to combine them into a single
pdf file side by side (without spacing in between) (left-right if they
are of the same height, and top-bottom if they are of the same width).

I could includegraphics in latex to have two pdf pages in a single pdf
pages. But the adjustment of the page margin and final pdf page size
may not be straightforward.

Could you please let me know what is the easiest way to put two pdf
pages in side by side in a single page?

GL

unread,
Apr 11, 2010, 5:04:46 PM4/11/10
to

There is the pdfpages package with something like that :

\includepdf[
pages={-}, % sélectionne toutes les pages
frame=true, % trace un cadre pour controle
% noautoscale, % pas de mise à l'échelle
nup=2, % nb page d'origine par page
% imprimées
% signature=4, % imposition des pages,
% 32 pour gros volume ?
% booklet=true, % true : imposition de
% l'ensemble des pages
% landscape, % pour format d'origine
% portrait
]{\pdffilename}

Excuse me it's late, and I drunk some (and pretty much) wine at dinner...

But pdfpages allows to do "booklets" (2 pages on one, with rearrangement
of pages in order to fold them together like a book).

anyway, pdfpages is your friend if you have to include, one way or
another, full pages from another pdf file. \includegraphics can do that,
but \includepdf is easier...

Regards

Marco Pessotto

unread,
Apr 12, 2010, 5:59:22 AM4/12/10
to
GL <goua...@gmail.com> writes:

> Le 11/04/2010 22:00, Peng Yu a écrit :
> There is the pdfpages package with something like that :
>
> \includepdf[
> pages={-}, % sélectionne toutes les pages
> frame=true, % trace un cadre pour controle
> % noautoscale, % pas de mise à l'échelle
> nup=2, % nb page d'origine par page
> % imprimées
> % signature=4, % imposition des pages,
> % 32 pour gros volume ?
> % booklet=true, % true : imposition de
> % l'ensemble des pages
> % landscape, % pour format d'origine
> % portrait
> ]{\pdffilename}
>
>

> But pdfpages allows to do "booklets" (2 pages on one, with
> rearrangement of pages in order to fold them together like a book).
>
> anyway, pdfpages is your friend if you have to include, one way or
> another, full pages from another pdf file. \includegraphics can do
> that, but \includepdf is easier...

Sorry to jump into the thread.

I'm very interested in this pdfpages package, because so far I always
used the long way to create imposed pdfs: .tex => (Xe)LaTeX => .pdf =>
(via pdftops from poppler) => .ps => psutils (psbook & psnup) => .pdf (via
ghostscript). This process is obviously slow and kind of CPU-killer.

Now, I've tried the pdfpages packages, but it looks like the logical
pages on the even physical pages are rotated by 180°. This perhaps it's
not a problem for printing (or maybe welcome on some printers), but I
found it strange because it's not the default behaviour of psbook. I did
read the manual, but I couldn't find a option to change this behaviour.

Am I missing something or exist some better solution to avoid
the pdf => ps => pdf chain to impose the pdf?

The desired layout (produced by the above descripted chain) is

http://theanarchistlibrary.org/pdfs/a4_imposed/John_Clark__A_Social_Ecology_a4_imposed.pdf

While if I rely on pdfpages I get

http://theanarchistlibrary.org/docs/test_imposed_pdfpages.pdf

which is way faster but not optimal for various reasons.

Source used:

\documentclass[a4paper,final]{minimal}
\usepackage{pdfpages}
\begin{document}
\includepdf[%
pages=-,%
frame=true,%
nup=1x2,%
booklet=true,
landscape,turn=true]{prova.pdf}
\end{document}

Where prova.pdf was a a5 compiled with XeLaTeX

Regards

--
Marco

Marco Pessotto

unread,
Apr 13, 2010, 9:06:25 AM4/13/10
to
Marco Pessotto <melm...@gmail.com> writes:

> GL <goua...@gmail.com> writes:
>
>> Le 11/04/2010 22:00, Peng Yu a écrit :
>> There is the pdfpages package with something like that :
>>
>> \includepdf[
>> pages={-}, % sélectionne toutes les pages
>> frame=true, % trace un cadre pour controle
>> % noautoscale, % pas de mise à l'échelle
>> nup=2, % nb page d'origine par page
>> % imprimées
>> % signature=4, % imposition des pages,
>> % 32 pour gros volume ?
>> % booklet=true, % true : imposition de
>> % l'ensemble des pages
>> % landscape, % pour format d'origine
>> % portrait
>> ]{\pdffilename}
>>
>>
>> But pdfpages allows to do "booklets" (2 pages on one, with
>> rearrangement of pages in order to fold them together like a book).
>>
>> anyway, pdfpages is your friend if you have to include, one way or
>> another, full pages from another pdf file. \includegraphics can do
>> that, but \includepdf is easier...
>

> Am I missing something or exist some better solution to avoid
> the pdf => ps => pdf chain to impose the pdf?
>
> The desired layout (produced by the above descripted chain) is
> http://theanarchistlibrary.org/pdfs/a4_imposed/John_Clark__A_Social_Ecology_a4_imposed.pdf
>
> While if I rely on pdfpages I get
>
> http://theanarchistlibrary.org/docs/test_imposed_pdfpages.pdf
>

It looks like that the answer to my own question is pdfjam (tested with
version 2.01).

Something like:
pdfjam --vanilla --suffix book \
--signature <signature> --landscape --paper a4paper \
pdffile.pdf


But the odd pages are displayed upside-down in the new pdf (because it's
a frontend for pdfpages).

Now, the question is: is there a way to change the layout of the odd
pages?

If not, does a similar layout can be easy printed on printers
with duplexing capabilities? (The poor men will just care how to turn
the print job).

Thanks in advance.

--
Marco

Marco Pessotto

unread,
Apr 19, 2010, 12:38:45 PM4/19/10
to

I asked the maintainer of pdfpages to answer some questions I previously
posted here. This is the reply, which I think is quite interesting. Huge
thanks to Andreas Matthias.

Hello Marco,

Marco Pessotto wrote:

> I'm trying to impose a large archive of +1000 pdfs. So far I used the
> chain pdftops => psbook => ps2pdf. Now that I found pdfpages (probably
> late, my bad), I'd like to use it for imposing (which is for sure
> superior, faster and preserve quality). But the "booklets" of the
> output appears with odd pages upside down. I don't know if this is the
> right thing to do. For sure this behaviour isn't the same as psbook
> and I'm somehow reclutant to change the appearence of the pdfs.

Pdfpages imposes the pages such that they should be turned over
the long edge (while printing), whereas with psnup they should be
turned over the short edge. In Postscript this is called /Tumble
which can be set to true or false.

Today all duplex printer should be able to do printing in short
edge mode as well as long edge mode. So this shouldn't be a
big issue.

However, if you like short edge printing more you can direct
pdftex (xetex) to rotate every second page. Here's an example:


\documentclass[a4paper,final]{article}
\usepackage{pdfpages}
\usepackage{ifpdf,ifxetex}
\makeatletter
\ifpdf
\EveryShipout{\ifodd\c@page\else\pdfpageattr{/Rotate 180}\fi}%
\fi
\ifxetex
\EveryShipout{\ifodd\c@page\special{pdf: put @thispage << /Rotate 180 >>}%
\fi
}
\fi
\makeatother

\begin{document}
\includepdf[pages=-, nup=1x2, booklet=true, landscape]{a5.pdf}
\end{document}


> If you think the behaviour of pdfpages is the correct one and the one
> of psbook is the wrong one (thinking about duplexing printing), please
> let me know.

It's just a question of `short edge' vs. `long edge' printing.
There's no right or wrong behaviour.

Ciao
Andreas


--
Marco

Heiko Oberdiek

unread,
Apr 19, 2010, 2:12:58 PM4/19/10
to
Marco Pessotto <melm...@gmail.com> wrote:

> \EveryShipout{\ifodd\c@page\else\pdfpageattr{/Rotate 180}\fi}%

Then you should load the package you need:
\usepackage{everyshi}

Otherwise it will be undefined with recent versions (pdfpages uses
eso-pic and that package now uses package atbegshi instead).

--
Heiko Oberdiek

Marco Pessotto

unread,
Apr 19, 2010, 1:19:53 PM4/19/10
to
Heiko Oberdiek <heiko.o...@googlemail.com> writes:

Good to know, thanks!

--
Marco

Peng Yu

unread,
May 17, 2010, 8:51:25 PM5/17/10
to goua...@gmail.com
> There is the pdfpages package with something like that :
>
> \includepdf[
>     pages={-},     % sélectionne toutes les pages
>     frame=true,    % trace un cadre pour controle
> %   noautoscale,      % pas de mise à l'échelle
>     nup=2,         % nb page d'origine par page
>              % imprimées
> %   signature=4,      % imposition des pages,
>              % 32 pour gros volume ?
> %   booklet=true,     % true : imposition de
>              % l'ensemble des pages
> %   landscape,     % pour format d'origine
>              % portrait
>     ]{\pdffilename}
>
> Excuse me it's late, and I drunk some (and pretty much) wine at dinner...
>
> But pdfpages allows to do "booklets" (2 pages on one, with rearrangement
> of pages in order to fold them together like a book).
>
> anyway, pdfpages is your friend if you have to include, one way or
> another, full pages from another pdf file. \includegraphics can do that,
> but \includepdf is easier...
>
> Regards

It is not exactly what I am looking for. Please see the example in the
following link.

http://rapidshare.com/files/388564121/018.tar.bz2

There is a wide space in between the two figures if I use the
following command.

\documentclass{article}
\usepackage[final]{pdfpages}

\begin{document}
\includepdfmerge[noautoscale,nup=1x2]{018T.pdf,018B.pdf}
\end{document}

The following commands will result in a very tiny space in between the
two figures. And I don't know how to get rid of it. Would you please
let me know how to get rid of the extra space?

\documentclass{article}
\usepackage{graphicx}

\begin{document}
\parbox{\linewidth}{
\includegraphics[scale=.5]{018T.pdf}\par
\includegraphics[scale=.5]{018B.pdf}
}
\end{document}


The above commands will result in white spaces on boundaries. I want
to automatically determine paper size from the figure size. Also I
want to combine 4 figures in the following layout. Could you please
let me know if there is a convenient way in latex? Or there is some
way in other tools other than latex?

+--------------+--------------------+
| | |
| | |
| | |
| +--------------------+
| | |
+--------------+ |
| | |
| | |
| | |
| | |
| | |
+--------------+--------------------+

Regards,
Peng

Reply all
Reply to author
Forward
0 new messages