[XeTeX] Shrink/expand page-height to fit
Wilfred van Rooijen
wvanrooijen at yahoo.com
Thu Jan 7 00:55:01 CET 2010
Hello,
I don't know if I fully understand what you want to achieve, but maybe the following might help.
Set the page size to some large value, so that the material will definitely fit on the page. Maybe something like:
\documentclass[a0paper]{memoir}
\begin{document}
\thispagestyle{empty} % make sure there is no pagenumber etc
\includegraphics[width=$DESIRED_WIDTH]{foo.pdf}
\end{document}
Now process this with pdflatex, and subsequently use pdfcrop:
pdfcrop file.pdf
This should crop the page to the size of the graphic. If you specify on the the width in the includegraphics command, the aspect ratio will be maintained. If the resullting figure is too big for the page, latex will give an "overfull box" warning.
If this is not what you want, then please post a small example and I am sure someone on the list will be able to help you out.
Cheerio,
Wilfred
--- On Thu, 7/1/10, Clinton Gormley <clint at traveljury.com> wrote:
> From: Clinton Gormley <clint at traveljury.com>
> Subject: [XeTeX] Shrink/expand page-height to fit
> To: xetex at tug.org
> Date: Thursday, 7 January, 2010, 3:16 AM
> Hi all
>
> I'm a beginner in *TEX, and I'm trying to do something
> which I hope is
> possible, but am not sure :)
>
> I need to generate PDFs, where each PDF contains a short
> advert which
> will appear in a newspaper.
>
> The column width is known beforehand, but the height isn't
> (other than
> an absolute maximum for the physical page height).
>
> So I'd like to be able to crop the page height to fit the
> contents,
> after the contents have been rendered.
>
> I've tried the 'preview', 'geometry' and 'pgfpages'
> packages, but
> without much success. I am considering trying
> something like:
>
> - set the page height to the absolute max
> - generate the content
> - redefine \shipout to:
> - store the content "somewhere"
> - measure the height of the content
> - render a second page of the correct
> size, with the stored
> content
> - discard the first page
>
> Is this the right way to approach this issue? As a
> beginner, it's a bit
> overwhelming figuring out the best approach to take, and
> TEX is somewhat
> difficult for the uninitiated to read (and I'm a Perl
> programmer!)
>
> Additionally, I'd like to draw a border around the content,
> with rounded
> edges - obviously I need to know the content height before
> drawing this
> box.
>
> Currently, I'm generating the PDF with xelatex, using
> pdfcrop to trim
> the excess height, then creating a new PDF with the border,
> and using
> the original PDF as an included image.
>
> This seems wasteful, and I'm sure can be done more
> efficiently in a
> single pass.
>
> Pointers gratefully accepted.
>
> many thanks
>
> Clint
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
New Email addresses available on Yahoo!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
More information about the XeTeX
mailing list