[texhax] [pdftex] image XObjects in pdfTeX or XeTeX PDF output?

Alexander Grahn A.Grahn at fzd.de
Mon Nov 22 16:03:05 CET 2010


On Mon, Nov 22, 2010 at 07:53:44AM -0500, William Adams wrote:
>On Nov 19, 2010, at 3:30 PM, Ross Moore wrote:
>
>(re: an image included multiple times being included but once and thereafter referred to)
>
>> PdfTeX does this automatically for you.
>
>So does XeTeX.

This may work with inclusion of external graphics from files, with TeX
boxes it doesn't:

\setbox0=\hbox{Hello World!}\copy0\copy0\copy0

does not create a Form XObject to be inserted on every \copy0, at least
at my end.

The XeTeX syntax for creating Form XObjects is different from pdfTeX
(see the dvipdfm manual):

\documentclass[a4paper]{article}

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}

\newsavebox\mybox
\savebox\mybox{\fbox{Hello world!}}

\begin{document}
\makeatletter

%distills \mybox into Form XObject for later reuse
\makebox[0pt][l]{%
\special{pdf:bxobj @myform
  width \strip at pt\wd\mybox pt
  height \strip at pt\ht\mybox pt
  depth \strip at pt\dp\mybox pt}%
\usebox\mybox%
\special{pdf:exobj}%
}

%reuse of Form XObject
\special{pdf: uxobj @myform}
\vspace{5ex}
\special{pdf: uxobj @myform}
\vspace{5ex}
\special{pdf: uxobj @myform}

\makeatother
\end{document}

Alexander


More information about the texhax mailing list