[XeTeX] Generating cropped PDF graphics file

Ross Moore ross at ics.mq.edu.au
Tue Apr 15 14:07:53 CEST 2008


Hello Chandra,

On 15/04/2008, at 4:27 PM, R (Chandra) Chandrasekhar wrote:
> Dear Folks,
>
> I used to generate an EPS graphics file for a logo by typesetting  
> the text and
> lines in LaTeX as foo.tex and compiling so
>
> latex foo
> dvips -E -ofoo.eps foo.dvi
> epstopdf foo.eps
>
> to get foo.pdf.
>
> I am now using TTF/OTF fonts in the logo and am using xelatex  
> instead, along
> with xcolor. I have two questions:
>
> 1. Does xdvipdfmx support colours defined in xcolor using
> \definecolor[named]{mycolor}{cmyk}{c, m, y, k} where c, m, y, k are  
> in [0, 1]?
>
> 2. To crop the generated PDF file to contain only the graphic, I am  
> compiling
> foo.tex so:
>
> xelatex foo
> pdfcrop foo
>
> to get the output foo-crop.pdf.
>
> Is this the preferred way to go about it, or is there another?

You can \shipout just a box containing the contents that you want.

For example, here's how you can do it with  pdfTeX
adding a frame for good measure.

%  put this in the preamble
\usepackage{graphicx}
\newbox\shipoutbox


%
%  wrap your content like this:
%
\setbox\shipoutbox=\hbox{%
    % <-----  put your contents here !!!
}%
\setbox0=\vbox{\kern-1truein
   \hbox{\kern-1truein
     \framebox{\box\shipoutbox}%  you don't really need the frame
   \kern1 truein}%
  \kern1truein}%
  \dimen0\ht0 \advance\dimen0\dp0
  \pdfpageheight\dimen0
  \pdfpagewidth\wd0
  \shipout\box0

Similar coding should work with XeTeX as it also
uses  \pdfpageheight  and  \pdfpagewidth .


>
> Many thanks.
>
> Chandra
> 15 Apr 08

Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.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
------------------------------------------------------------------------





More information about the XeTeX mailing list