## Using context as PDF file manipulator

### Using context as PDF file manipulator

I have a bunch of PDF files which I would like to combine into a
single PDF file. Some of the files should be scaled, some of them
slightly shifted. I've gotten the impression that this can be done by
either use the ConTeXt texexec script directly or write a simple
context document that includes the PDF files in the relevant order
with the relevant transformations.

Has anyone actually done this? Are there some sample files that I
could take a look at?

Thanks,

/Lars

--

### Using context as PDF file manipulator

> I have a bunch of PDF files which I would like to combine into a
> single PDF file. Some of the files should be scaled, some of them
> slightly shifted. I've gotten the impression that this can be done by
> either use the ConTeXt texexec script directly or write a simple
> context document that includes the PDF files in the relevant order
> with the relevant transformations.

texexec manipulation actually resorts to a temp ConTeXt file so IME
you'd better off with the ConTeXt wrapper yourself ...

Quote:

> Has anyone actually done this? Are there some sample files that I
> could take a look at?

Me. Yes.

Oh, you actually wanted one of them? Ok, here's something you can use
as a model:

\setuppapersize[A4][A3,landscape]
\setuparranging[2UP]
\setuplayout
[topspace=0pt,
backspace=0pt,
footer=0pt,
width=middle,
height=middle]
\starttext
\insertpages[atd.pdf]
\stoptext

The core command is \insertpages. From the page-imp.tex
documentation:

%D One can (mis)use this mechanism, in close cooperation
%D with \PDFTEX\ to arrange pages of already produced files.
%D
%D \starttypen
%D \insertpages[file.pdf][1,3][n=30,width=18cm]
%D \stoptypen
%D
%D The pages are inserted in the text area, and even pages
%D are repositioned according to the width. In this example
%D empty pages are added after page 1 and 3.
%D
%D Selecting pages can be accomplished by:
%D
%D \starttypen
%D \filterpages[file.pdf][1,3,5][n=30,width=18cm]
%D \stoptypen
%D
%D One may pass \type {odd} or \type {even} instead of a
%D comma separated list. A third alternative is:
%D
%D \starttypen
%D \copypages[file.pdf][n=30,scale=950]
%D \stoptypen
%D
%D This macros inserts the page, according to the settings
%D provided.

ConTeXt also provides the following command:

%D \macros
%D   {combinepages}
%D
%D Yet another way of postprocessing is handles by \type
%D {\combinepages}. This macro builds a matrix of pages from a
%D file, for example:
%D
%D \starttypen
%D \setuppapersize
%D   [A4][A4] % or [A4,landscape][A4,landscape]
%D
%D \setuplayout
%D    backspace=1cm,topspace=1cm,
%D    width=middle,height=middle]
%D
%D \setupfootertexts
%D   [presentation---\currentdate\space---\space\pagenumber]
%D
%D \starttext
%D   \combinepages[slides][nx=2,ny=3,frame=on]
%D \stoptext
%D \starttypen
%D
%D One can influence the way the pages are combined. (This
%D will be explained some time.)

--
Giuseppe "Oblomov" Bilotta

"Da grande lotter per la pace"
"A me me la compra il mio babbo"
(Altan)
("When I grow up, I will fight for peace"

### Using context as PDF file manipulator

> Oh, you actually wanted one of them? Ok, here's something you can use
> as a model:

Great! Thanks!

/Lars

### Using context as PDF file manipulator

Quote:> > I have a bunch of PDF files which I would like to combine into a
> > single PDF file. Some of the files should be scaled, some of them
> > slightly shifted. I've gotten the impression that this can be done by
> > either use the ConTeXt texexec script directly or write a simple
> > context document that includes the PDF files in the relevant order
> > with the relevant transformations.

> texexec manipulation actually resorts to a temp ConTeXt file so IME
> you'd better off with the ConTeXt wrapper yourself ...

> > Has anyone actually done this? Are there some sample files that I
> > could take a look at?

> Me. Yes.

I use Adobe Acrobat for this - it's much simpler with a graphical interface.

### Using context as PDF file manipulator

Quote:>> > I have a bunch of PDF files which I would like to combine into a
>> > single PDF file. Some of the files should be scaled, some of them
>> > slightly shifted. I've gotten the impression that this can be done by
>> > either use the ConTeXt texexec script directly or write a simple
>> > context document that includes the PDF files in the relevant order
>> > with the relevant transformations.

>> texexec manipulation actually resorts to a temp ConTeXt file so IME
>> you'd better off with the ConTeXt wrapper yourself ...

>> > Has anyone actually done this? Are there some sample files that I
>> > could take a look at?

>> Me. Yes.

> I use Adobe Acrobat for this - it's much simpler with a graphical interface.

I have 80 PDF files that total to 180 pages and I need to rescale them
from A4 to slightly less than A5, place the new pages centered on A5
sheets and then shift the page contents of all pages down by 5mm.

Is it really possible to do this in Adobe Acrobat? (I have Adobe
Acrobat and I have tried to figure out how to do it, alas without
success.)

/Lars

### Using context as PDF file manipulator

Quote:>I have 80 PDF files that total to 180 pages and I need to rescale them
>from A4 to slightly less than A5,

Batch print them to a page size / scaling which is correct for what you want
and re-distill.

Quote:>place the new pages centered on A5
>sheets

It'll center by default.

Quote:>and then shift the page contents of all pages down by 5mm.

You'd need PitStop for that, or you could define the pagesize as 10mm too large
at the top and then trim 5mm top and bottom (or something like that).

William

--
Sphinx of black quartz, judge my vow.

### Using context as PDF file manipulator

> I use Adobe Acrobat for this - it's much simpler with a graphical interface.

Nonscriptable, nontunable and noncheap.

--
Giuseppe "Oblomov" Bilotta

"Da grande lotter per la pace"
"A me me la compra il mio babbo"
(Altan)
("When I grow up, I will fight for peace"

### Using context as PDF file manipulator

> I have 80 PDF files that total to 180 pages and I need to rescale them
> from A4 to slightly less than A5, place the new pages centered on A5
> sheets and then shift the page contents of all pages down by 5mm.

You can do this with pdfpages.sty. The drawback is that
you lose all kinds of hyperlinks.

\documentclass[a5paper]{article}
%% If papersize is not exactly A5:
%% \setlength\paperwidth{...}
%% \setlength\paperheight{...}
%% \setlength\pdfpagewidth{\paperwidth}
%% \setlength\pdfpageheight{\paperheight}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-, offset=0mm -5mm]{dummy.pdf}
\end{document}

Ciao
Andreas

This one's too low level for me -- I've no idea where to start
debugging it:

The latest ConTeXt Beta (2002.5.26) won't work with the
mfpic package (0.5.0).

I've attached a minimal example, and the resultant log:

%--------------------------------------------------
\input mfpic
\usemetapost

\bye
%--------------------------------------------------

This is pdfeTeX, Version 3.14159-1.00b-pretest-20020211-2.1
(Web2c 7.3.7) (format=pdfetex 2002.5.14)  3 JUN 2002 11:37
entering extended mode
**tryMFpic.tex
(./tryMFpic.tex{c:/Local/TeX/texmf-var/pdftex/config/pdftex.cfg}
(c:/Local/TeX/texmf-local/tex/generic/mfpic/mfpic.tex
MFpic: 2001/10/30 version 0.5.0 beta.

\mfpicheight=\dimen17
\mfpicwidth=\dimen18
\mfpframesep=\dimen19
\mfpframethickness=\dimen20

) (c:/Local/TeX/texmf-local/tex/context/base/supp-pdf.tex
(c:/Local/TeX/texmf-local/tex/context/base/supp-mis.tex
\protectiondepth=\count32
\scratchcounter=\count33
\scratchtoks=\toks16
\scratchdimen=\dimen21
\scratchskip=\skip18
\scratchmuskip=\muskip10
\scratchbox=\box18
\scratchwrite=\write1
\zeropoint=\dimen22
\nextbox=\box19
\nextdepth=\dimen23
\everyline=\toks17
\!!counta=\count34
\!!countb=\count35
\recursecounter=\count36
)
\nofMPsegments=\count37
\nofMParguments=\count38
Runaway argument?
\par
! Forbidden control sequence found while scanning use of \beginETEX.
<inserted text>
\par
\newdimen
l.1284   \newdimen
\MPcriteriumA \MPcriteriumA=512pt
? s
OK, entering \scrollmode...
\MPcriteriumA=\dimen24
\MPcriteriumB=\dimen25
! Undefined control sequence.
l.1287 \endETEX

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

\everyMPtoPDFconversion=\toks18
) )
No pages of output.