Is it possible to exchange odd and even pages in a pdf file, e.g. page 1 and page 2 exchange, page 3 and page 4 exchange, ..., assuming the pdf file has even number of pages?
Can it be done using some software e.g. pdftk or LaTeX?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityIt seems like pdftk's shuffle
feature will do this. From man pdftk
:
shuffle [<page ranges>]
Collates pages from input PDFs to create a new PDF. Works
like the cat operation except that it takes one page at a
time from each page range to assemble the output PDF.
The general format for a [<page range>]
is given as
<input PDF handle>[<begin page number>[-<end page number>[<qualifier>]]][<page rotation>]
where qualifier
may be either even
or odd
. In the case that you wish to take alternating even and odd pages from the same document until all pages are exhausted, you can omit the <input PDF handle>
and <begin page number>-<end page number>
specifiers leaving just
pdftk infile.pdf shuffle even odd output outfile.pdf
where infile.pdf
is the file whose pages are to be swapped and outfile.pdf
is a name for the output.
You can use qpdf
qpdf input.pdf --collate --pages . 1-z:even . 1-z:odd -- output.pdf
See QPDF Documentation.