# [OS X TeX] Can TeX help out here? Merging PDF with various page sizes and keeping it vector.

Ross Moore ross.moore at mq.edu.au
Sat Jan 14 00:44:40 CET 2012

Hi Gerben,

On 14/01/2012, at 10:06 AM, Gerben Wierda wrote:

> So far ConTeXt seems to be able to do it, but it is messy. E.g. rotating an image and putting it on a page messes up the fit-to-papersize of ConTeXt, etc.

TeX's  \shipout  primitive can be called at any time, to create
a PDF page consisting of exactly the contents of any \vbox , and
sized according to the dimens of that box.

In LaTeX, the \shipout is called by the \output routine, after adding
Similarly with ConText's page-building routines.
But all that extra stuff can be bypassed by directly calling \shipout .
However, you have to take into account the \voffset and \hoffset
dimen registers when you do the \shipout .

Another way is to just use the pdfpages package with appropriate
options. Here is some coding that I've used to insert a photograph
as landscape, within a document that is otherwise portrait.
It also sets up a \label, so that the rest of the document can
hyperlink to this extra page, and inserts a ToC entry.

\newcommand{\includeAnnex}[3][Annex ]{\refstepcounter{subsection}%
{\def\tmp{#2}\def\empty{}%
\ifx\tmp\empty\gdef\annexID{}\label{#1}%
\else\gdef\annexID{#1#2: }\label{annex#2}\fi
\pdfstringdefPreHook
{\protect \numberline {\csname thesubsection\endcsname }\annexID#3}%
}\ifx\relax#2\relax\else\markright{\annexID#3}\fi}

\newpage
\expandafter\ifx\csname pdfliteral\endcsname\relax\else
\pdfdest name{dinner} fitv
\fi
\includeAnnex[groupphoto]{}{photographs of participating delegates}%
\includepdf[landscape=true%
,noautoscale=true,scale=1.33,offset=0cm 0cm,pagecommand={\thispagestyle{empty}}%
]{../Firenze-22-05-2005/GroupPhoto.jpg}%

>
> G
>
> On 13 Jan 2012, at 17:01, Herbert Schulz wrote:
>
>>
>> On Jan 13, 2012, at 9:13 AM, Gerben Wierda wrote:
>>
>>> Summary:
>>> - One PDF as result
>>> - Each page has a different size and orientation
>>> - Each page contains a PDF vector image that is not to be converted to pixels

\includepdf  allows all of this, within its available options.

If you want to see more examples, contact me off-list.

>
>>>
>>> Yours,
>>>
>>> G

Cheers,

Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------