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 I?m 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 doesn?t overflow the box. I don?t 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(_at_)mentea(_dot_)net
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/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--