Loading ...
Sorry, an error occurred while loading the content.
 

Different PDF results from a simple FO file

Expand Messages
  • raymundo2104
    Hi, Here is the FO code: ================= START OF CODE ======================
    Message 1 of 3 , Apr 29, 2003
      Hi,

      Here is the FO code:

      ================= START OF CODE ======================
      <?xml version="1.0" encoding="utf-8"?>
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
      <fo:simple-page-master
      master-name="spm"
      page-width="31.375cm"
      page-height="22cm">

      <fo:region-before
      region-name="before"
      extent="1.76cm"/>

      <fo:region-after
      region-name="after"
      extent="1.76cm"/>

      <fo:region-start
      region-name="start"
      extent="7.69cm"/>

      <fo:region-end
      region-name="end"
      extent="0cm"/>

      <fo:region-body
      region-name="body"
      margin-top="1.76cm"
      margin-bottom="1.76cm"
      margin-left="7.69cm"
      margin-right="0cm"
      />

      </fo:simple-page-master>
      </fo:layout-master-set>


      <fo:page-sequence master-reference="spm">

      <fo:static-content flow-name="before">
      <fo:block>
      <fo:table table-layout="fixed">
      <fo:table-column column-number="1" column-width="23.685cm"/>
      <fo:table-body>
      <fo:table-row height="1.76cm" display-align="center">
      <fo:table-cell
      border-top-color="black"
      border-top-style="solid"
      border-top-width="0.23cm"
      border-bottom-color="black"
      border-bottom-style="solid"
      border-bottom-width="0.12cm"
      border-left-color="black"
      border-left-style="solid"
      border-left-width="0.12cm"
      border-right-color="black"
      border-right-style="solid"
      border-right-width="0.215cm"
      background-color="yellow"
      >
      <fo:block text-align="center">region-before</fo:block>
      </fo:table-cell>
      </fo:table-row>
      </fo:table-body>
      </fo:table>
      </fo:block>
      </fo:static-content>


      <fo:static-content flow-name="after">
      <fo:block>
      <fo:table table-layout="fixed">
      <fo:table-column column-number="1" column-width="23.685cm"/>
      <fo:table-body>
      <fo:table-row height="1.76cm" display-align="center">
      <fo:table-cell
      border-top-color="black"
      border-top-style="solid"
      border-top-width="0.12cm"
      border-bottom-color="black"
      border-bottom-style="solid"
      border-bottom-width="0.23cm"
      border-left-color="black"
      border-left-style="solid"
      border-left-width="0.12cm"
      border-right-color="black"
      border-right-style="solid"
      border-right-width="0.215cm"
      background-color="yellow"
      >
      <fo:block text-align="center">region-after</fo:block>
      </fo:table-cell>
      </fo:table-row>
      </fo:table-body>
      </fo:table>
      </fo:block>
      </fo:static-content>


      <fo:static-content flow-name="start">
      <fo:block>
      <fo:table table-layout="fixed">
      <fo:table-column column-number="1" column-width="7.69cm"/>
      <fo:table-body>
      <fo:table-row height="22cm" display-align="center">
      <fo:table-cell
      border-top-color="black"
      border-top-style="solid"
      border-top-width="0.23cm"
      border-bottom-color="black"
      border-bottom-style="solid"
      border-bottom-width="0.23cm"
      border-left-color="black"
      border-left-style="solid"
      border-left-width="0.28cm"
      border-right-color="black"
      border-right-style="solid"
      border-right-width="0.14cm"
      background-color="yellow"
      >
      <fo:block text-align="center">region-start</fo:block>
      </fo:table-cell>
      </fo:table-row>
      </fo:table-body>
      </fo:table>
      </fo:block>
      </fo:static-content>


      <fo:flow flow-name="body">
      <fo:block>
      <fo:table table-layout="fixed">
      <fo:table-column column-number="1" column-width="23.685cm" />
      <fo:table-body>
      <fo:table-row height="18.48cm" display-align="center">
      <fo:table-cell
      border-top-color="black"
      border-top-style="solid"
      border-top-width="0.35cm"
      border-bottom-color="black"
      border-bottom-style="solid"
      border-bottom-width="0.35cm"
      border-left-color="black"
      border-left-style="solid"
      border-left-width="0.12cm"
      border-right-color="black"
      border-right-style="solid"
      border-right-width="0.215cm"
      background-color="gray"
      >
      <fo:block text-align="center">region-body</fo:block>
      </fo:table-cell>
      </fo:table-row>
      </fo:table-body>
      </fo:table>
      </fo:block>
      </fo:flow>
      </fo:page-sequence>
      </fo:root>

      =================END OF CODE ======================

      I ran the above code using FOP 0.20.5RC and got the following
      warnings:

      [WARNING] Some static content could not fit in the area
      [WARNING] Some static content could not fit in the area
      [WARNING] Some static content could not fit in the area

      FOP 0.20.5RC created a 2-page PDF file where I expect only 1 page!
      The 2nd page was blank!

      Then I tried XSL Formatter 2.4.2003.312 (eval) and I did not get any
      errors nor warnings and got 1 page and the result I expected.

      Then I tried XEP 3.12 (eval) and I got this message:
      {!no space for an element, trying to recover}

      XEP 3.12 did create a 1-page PDF file but the result is the worst
      amongst the 3 renderers.

      I would appreciate it if anyone could point out to me whether my math
      is wrong: page width and height vs regions' widths and heights and
      regions' border widths) or it is a bug (in FOP 0.20.5RC or XEP 3.12 --
      XSL Formatter did not flag any errors or warnings). This is pretty
      basic, my requirement is far more complicated with background images
      in each regions to be populated with text from XML and graphics
      imported from bitmaps. XSL Formatter turned out the result I
      expected (or at least I wish to see).

      I am surprised at the different PDF files produced. My worry is XSLT
      stylesheet maintenance issue -- updating codes when moving from 1
      renderer to the another.

      Any comments, suggestions, corrections, etc., from the XSL-FO
      community will be very much appreciated.

      Thanks and regards,


      Rico Raymundo
      Senior Applications Developer
      NetImpact Online Publishing
      enrico@...
    • W. Eliot Kimber
      ... I notice two things immediately: - you ve set the vertical size of the table to be precisely the same as the vertical extent of the area. Depending on the
      Message 2 of 3 , Apr 30, 2003
        raymundo2104 wrote:

        >
        > I ran the above code using FOP 0.20.5RC and got the following
        > warnings:
        >
        > [WARNING] Some static content could not fit in the area
        > [WARNING] Some static content could not fit in the area
        > [WARNING] Some static content could not fit in the area
        >
        > FOP 0.20.5RC created a 2-page PDF file where I expect only 1 page!
        > The 2nd page was blank!
        >
        > Then I tried XSL Formatter 2.4.2003.312 (eval) and I did not get any
        > errors nor warnings and got 1 page and the result I expected.
        >
        > Then I tried XEP 3.12 (eval) and I got this message:
        > {!no space for an element, trying to recover}
        >
        > XEP 3.12 did create a 1-page PDF file but the result is the worst
        > amongst the 3 renderers.

        I notice two things immediately:

        - you've set the vertical size of the table to be precisely the same as
        the vertical extent of the area. Depending on the details of how the FO
        implementation works, this might lead to problems, as there could be
        subtle things like accounting for border widths.

        - Your use of tables is completely unnecessary (at least with XEP and
        XSL Formatter). You can get the same effect with a simple block
        container, e.g.:

        <fo:static-content>
        <fo:block-container
        block-progression-dimension="100%"
        inline-progression-dimension="100%"
        display-align="center"
        text-align="center"
        border-top-color="black"
        border-top-style="solid"
        border-top-width="0.23cm"
        border-bottom-color="black"
        border-bottom-style="solid"
        border-bottom-width="0.12cm"
        border-left-color="black"
        border-left-style="solid"
        border-left-width="0.12cm"
        border-right-color="black"
        border-right-style="solid"
        border-right-width="0.215cm"
        background-color="yellow">
        <fo:block>region before</fo:block>
        </fo:block-container>
        </fo:static-content>

        By using percentages for the dimensions of the blocks you also avoid any
        overflow conditions.

        Also, your specification of zero-width region-end and corresponding body
        region margin is unnecessary--an unspecified region has no extent
        (because it doesn't exist).

        BTW, as a rule XEP will provide the best error reporting of any of the
        FO implementations, while XSL Formatter is the most forgiving and does
        not claim to be a validating FO processor. For that reason, even when
        I'm using XSL Formatter for my final rendering, I like to use XEP to
        validate my FO instances.

        Cheers,

        E.
        --
        W. Eliot Kimber, eliot@...
        Consultant, ISOGEN International

        1016 La Posada Dr., Suite 240
        Austin, TX 78752 Phone: 512.656.4139
      • raymundo2104
        ... page! ... any ... same as ... the FO ... be ... and ... avoid any ... body ... the ... does ... when ... to ... Hi Eliot, Many thanks for your reply. I
        Message 3 of 3 , Apr 30, 2003
          --- In XSL-FO@yahoogroups.com, "W. Eliot Kimber" <eliot@i...> wrote:
          > raymundo2104 wrote:
          >
          > >
          > > I ran the above code using FOP 0.20.5RC and got the following
          > > warnings:
          > >
          > > [WARNING] Some static content could not fit in the area
          > > [WARNING] Some static content could not fit in the area
          > > [WARNING] Some static content could not fit in the area
          > >
          > > FOP 0.20.5RC created a 2-page PDF file where I expect only 1
          page!
          > > The 2nd page was blank!
          > >
          > > Then I tried XSL Formatter 2.4.2003.312 (eval) and I did not get
          any
          > > errors nor warnings and got 1 page and the result I expected.
          > >
          > > Then I tried XEP 3.12 (eval) and I got this message:
          > > {!no space for an element, trying to recover}
          > >
          > > XEP 3.12 did create a 1-page PDF file but the result is the worst
          > > amongst the 3 renderers.
          >
          > I notice two things immediately:
          >
          > - you've set the vertical size of the table to be precisely the
          same as
          > the vertical extent of the area. Depending on the details of how
          the FO
          > implementation works, this might lead to problems, as there could
          be
          > subtle things like accounting for border widths.
          >
          > - Your use of tables is completely unnecessary (at least with XEP
          and
          > XSL Formatter). You can get the same effect with a simple block
          > container, e.g.:
          >
          > <fo:static-content>
          > <fo:block-container
          > block-progression-dimension="100%"
          > inline-progression-dimension="100%"
          > display-align="center"
          > text-align="center"
          > border-top-color="black"
          > border-top-style="solid"
          > border-top-width="0.23cm"
          > border-bottom-color="black"
          > border-bottom-style="solid"
          > border-bottom-width="0.12cm"
          > border-left-color="black"
          > border-left-style="solid"
          > border-left-width="0.12cm"
          > border-right-color="black"
          > border-right-style="solid"
          > border-right-width="0.215cm"
          > background-color="yellow">
          > <fo:block>region before</fo:block>
          > </fo:block-container>
          > </fo:static-content>
          >
          > By using percentages for the dimensions of the blocks you also
          avoid any
          > overflow conditions.
          >
          > Also, your specification of zero-width region-end and corresponding
          body
          > region margin is unnecessary--an unspecified region has no extent
          > (because it doesn't exist).
          >
          > BTW, as a rule XEP will provide the best error reporting of any of
          the
          > FO implementations, while XSL Formatter is the most forgiving and
          does
          > not claim to be a validating FO processor. For that reason, even
          when
          > I'm using XSL Formatter for my final rendering, I like to use XEP
          to
          > validate my FO instances.
          >
          > Cheers,
          >
          > E.
          > --
          > W. Eliot Kimber, eliot@i...
          > Consultant, ISOGEN International
          >
          > 1016 La Posada Dr., Suite 240
          > Austin, TX 78752 Phone: 512.656.4139




          Hi Eliot,

          Many thanks for your reply. I tried your suggestion and it did work
          perfectly with RenderX' XEP. But didn't work with XSL formatter. I
          got the following:

          Area overflow: region-before (page 1)

          Here's the code:

          <fo:static-content flow-name="before">
          <fo:block-container
          block-progression-dimension="100%"
          inline-progression-dimension="100%"
          display-align="center"
          text-align="center"
          border-top-color="black"
          border-top-style="solid"
          border-top-width="0.23cm"
          border-bottom-color="black"
          border-bottom-style="solid"
          border-bottom-width="0.12cm"
          border-left-color="black"
          border-left-style="solid"
          border-left-width="0.12cm"
          border-right-color="black"
          border-right-style="solid"
          border-right-width="0.215cm"
          background-color="yellow">
          <fo:block>region before</fo:block>
          </fo:block-container>
          </fo:static-content>

          FOP 0.20.5RC produced more errors as expected (got this before
          everytime I use "block-progression-dimension" attribute:
          [ERROR] Error in block-progression-dimension propert
          value '100%' ..... No conversion defined

          The use of table is due to the persistence to use FOP as I need to
          produce hundreds of PDF files. I need to experiment some more and
          post when I discover something interesting. Greatly appreciate your
          time and effort to help. You are heaven-sent to this community!

          Cheers,

          Enrico Raymundo
          Senior Applications Developer
          NetImpact Online Publishing
          enrico@...
        Your message has been successfully submitted and would be delivered to recipients shortly.