FOP Dynamic Heading Size?

Discussion in 'XML' started by Devon, Jan 15, 2004.

  1. Devon

    Devon Guest

    Hi All,
    I'm generating a pdf document using FOP .25 from Apache. I've created
    running dynamic headings (e.g. chapter titles) that change as dictated
    by the XML source I'm converting to PDF. Now thats fine. My clients
    wish to include a variable length note as well in this page region.
    Trouble is I've only been able to do this by statically sizing the
    region to house this data. If no data (e.g. the note) exists for a
    given heading - just white space is shown. The clients hate it and
    apparently this is a show-stopping issue. A mustfix.

    Is there a way to have the fo-region-before shrink / grow dynamically
    based on the data display within that region?
    Devon, Jan 15, 2004
    #1
    1. Advertising

  2. The size of a static-content region can't be dynamic, but you can calc
    the size based on the size of your note. Ex:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <xsl:template match="/">
    <fo:root>
    <fo:layout-master-set>

    <xsl:variable name="size" select="string-length(/xml/note/text()) div
    50"/>

    <fo:simple-page-master master-name="report_page_master"
    page-height="11in" page-width="8.5in">
    <fo:region-body region-name="xsl-region-body" margin=".5in"
    margin-top="{$size}in"/>

    ....

    This counts the number of chars making up the note node to calc the
    size. You'll probaly want to figure out your own magic number instead
    of 50, but you'll want to use that variable in the margin-top of
    region-body and the extent of region-before.

    Mike


    (Devon) wrote in message news:<>...
    > Hi All,
    > I'm generating a pdf document using FOP .25 from Apache. I've created
    > running dynamic headings (e.g. chapter titles) that change as dictated
    > by the XML source I'm converting to PDF. Now thats fine. My clients
    > wish to include a variable length note as well in this page region.
    > Trouble is I've only been able to do this by statically sizing the
    > region to house this data. If no data (e.g. the note) exists for a
    > given heading - just white space is shown. The clients hate it and
    > apparently this is a show-stopping issue. A mustfix.
    >
    > Is there a way to have the fo-region-before shrink / grow dynamically
    > based on the data display within that region?
    Mike Partridge, Jan 15, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmltIEhlYXZleQ==?=

    DataGrid Heading

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Dec 10, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    1,456
    Curt_C [MVP]
    Dec 10, 2004
  2. =?Utf-8?B?ZGVubmlzdDY4NQ==?=

    Format text as a heading

    =?Utf-8?B?ZGVubmlzdDY4NQ==?=, Nov 22, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    529
    Mark Wills
    Sep 14, 2006
  3. jack-e

    List Box Heading

    jack-e, Feb 12, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    476
    =?Utf-8?B?RFdT?=
    Feb 12, 2006
  4. dm1608
    Replies:
    1
    Views:
    1,597
    Eliyahu Goldin
    Feb 19, 2006
  5. Pablo
    Replies:
    0
    Views:
    928
    Pablo
    Mar 28, 2007
Loading...

Share This Page