# [pdftex] Adding objects to the page

Patrick Gundlach pg at levana.de
Tue Jan 26 15:56:42 CET 2010

Hello Heiko,

> Package atbegshi'. With \AtBeginShipoutUpperLeft and
> \AtBeginShipoutUpperLeftForeground you can put things in the
> background or foreground of the output box inside \AtBeginShipout.

Gee! I need to get TeXbrain 2.0 before I understand what is going on there. If
I come across a similar problem, I will try out 'atbegshi'.

If someone (the archive) wants to know what I am doing now... (some off topic LuaTeX code following)

I have taken this from plain.tex:

\def\plainoutput{\shipout\vbox{\dothingsbeforeoutput\pagebody\makefootline}%
\ifnum\outputpenalty>-20000 \else\dosupereject\fi}

this is \dothingsbeforeoutput:

\def\dothingsbeforeoutput{
\directlua{dothingsbeforeoutput()}
}

and there I collect \pdfliteral page {......} TeX-strings and write back
to TeX via 'tex.sprint("\\pdfliteral page {.....}")'. This way I make
sure these pdfilterals come before the page contents. That was a very
easy hack. I hope it has no side effects.

Thanks!

Patrick
--
ConTeXt wiki and more: http://contextgarden.net
`