[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Fitting content to a box in FO
Subject: Re: [xsl] Fitting content to a box in FO From: "Tony Graham" <tgraham@xxxxxxxxxx> Date: Wed, 13 Nov 2013 14:09:55 -0000 (GMT) |
On Wed, November 13, 2013 9:27 am, Nic Gibson wrote: > I have a question. Is there a way to state in XSL-FO here is a block of > text (and possibly images), scale it to this maximum size? The background > is that Im looking to add better printing to the code I use to generate > slides for presentations. The slides are originally HTML and fill a single > page - the screen. I want to print those out 3 or 4 to a page. Given > that I know the size of the page I can work out exactly how large the > box for each slide should be. However, I want to make sure that the > slide doesnt overflow the box. I dont really care that much if content > is shrunk to fit, I just want to make sure it fits the box. The messy-but-one-pass solution that preserves the proportions of your slides would be to generate each slide as SVG and include each as either fo:instream-foreign-object or fo:external-graphic with @max-height [1] set. For bonus points, you could use @allowed-width-scale [2] so that your over-tall slides scale down to a consistent set of font sizes. The two-pass--all-FO solution -- as I describe at [3] -- would be run it once with unconstrained height and get the area tree to work out how to scale the slides. For bonus points, you could generate an initial FO file that has every slide at a range of font sizes and image magnifications, get the area tree, and work out which font size works best for each slide. The bleeding-edge solution [4] is to use FOP and the FOPRunXSLTExt [5] extension from the Print and Page Layout CG to iteratively adjust the font-size, etc., and run the FO processor from within your XSLT transform until you have the optimal settings, which you then include in the 'real' FO output. For bonus points of a different kind, you could port the extension to Antenna House's or RenderX's Java interface and contribute that back to the CG. Regards, Tony Graham tgraham@xxxxxxxxxx Consultant http://www.mentea.net Mentea 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- XML, XSL-FO and XSLT consulting, training and programming Chair, Print and Page Layout Community Group @ W3C [1] http://www.w3.org/TR/xsl11/#max-height [2] http://www.w3.org/TR/xsl11/#allowed-width-scale [3] http://www.balisage.net/Proceedings/vol10/html/Graham01/BalisageVol10-Graham01.html#d44854e105 [4] That sometimes feels like the flogging-a-dead-horse solution [5] http://www.w3.org/community/ppl/wiki/FOPRunXSLTExt#Example_5_-_Copyfitting_by_adjusting_.27font-size.27 [6] http://www.w3.org/community/ppl/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Fitting content to a box in F, Nic Gibson | Thread | Re: [xsl] Fitting content to a box , Kevin Brown |
Re: [xsl] xsl:include, Nic Gibson | Date | Re: [xsl] Fitting content to a box , Kevin Brown |
Month |