[XeTeX] Generating a PDF which is cropped to the bounding box?

Jonathan Kew jfkthame at googlemail.com
Sat Jan 29 20:03:28 CET 2011


On 29 Jan 2011, at 18:57, Adam Twardoch (List) wrote:

> Jonathan etc.,
> 
> I have a simple XeTeX script that produces one line of text. The line
> (or the artwork, in general) has a certain bounding box. I'd like to
> generate a PDF that is cropped exactly to the size of that artwork. Can
> I do this directly in XeTeX? If not, is there any way to do it directly
> using ghostscript?

Use \pdfpagewidth and \pdfpageheight to set the dimensions you want; and \hoffset and \voffset to get rid of the default TeX margins.

If you don't know the size of the line of text ahead of time, set it in an \hbox and then examine its dimensions (\wd, \ht, \dp) to set the PDF dimensions appropriately.

JK




More information about the XeTeX mailing list