W3C home > Mailing lists > Public > www-xsl-fo@w3.org > July 2009

Re: XSL-FO to generate a PDF document

From: Tony Graham <Tony.Graham@MenteithConsulting.com>
Date: Mon, 20 Jul 2009 18:06:30 +0100
To: www-xsl-fo@w3.org
Message-ID: <87tz17cmi1.fsf@menteith.com>
On Thu, Jul 16 2009 02:59:13 +0100, ubi.nunes@topazsolutions.co.nz wrote:
...
> Thanks for the suggestion, but unfortunately it didn't work. I have paste
> the code I'm trying to get to work. If you can review it and maybe give
> another suggestion would be great.

I tweaked your SVG a bit, but I had to put the SVG in an external
'cross.svg' file before I could get the cross to resize properly.

Also, it would have helped if you'd posted FO markup starting at
fo:root.  You also had xfd:* elements in your FO that had to be removed,
and setting every column's width to 100% isn't really very effective.

This FO markup (with the SVG copied to 'cross.svg') works okay in Antenna
House Formatter V5:

------------------------------------------------------------
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink">
  <fo:layout-master-set>
    <fo:simple-page-master page-width="297mm" page-height="210mm" margin-right="0.75in" margin-left="0.2in" margin-bottom="0.0in" margin-top="0.375in" master-name="coverPage">
      <fo:region-body margin-bottom="0.9in" margin-top="0.6in" region-name="xsl-region-body_coverpage"/>
      <fo:region-before extent="0.5in" region-name="xsl-region-before_coverpage"/>
      <fo:region-after extent="0.9in" region-name="xsl-region-after_allpages"/>
    </fo:simple-page-master>
    <fo:simple-page-master page-width="297mm" page-height="210mm" margin-right="0.75in" margin-left="0.2in" margin-bottom="0.0in" margin-top="0.375in" master-name="Page2">
      <fo:region-body margin-bottom="0.9in" margin-top="0.6in" region-name="xsl-region-body"/>
      <fo:region-before extent="0.5in" region-name="xsl-region-before_page2"/>
      <fo:region-after extent="0.9in" region-name="xsl-region-after_allpages"/>
    </fo:simple-page-master>
    <fo:page-sequence-master master-name="master2">
      <fo:repeatable-page-master-reference  master-reference="Page2"/>
    </fo:page-sequence-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="master2">
    <fo:flow flow-name="xsl-region-body" font-family="Times" font-size="12pt">
  <fo:block keep-together="always" wrap-option="no-wrap"
    keep-together.within-page="always">
    <fo:table table-layout="fixed" width="100%" height="10%"
      border-collapse="collapse">
      <fo:table-column column-width="proportional-column-width(1)" column-number="1"/>
      <fo:table-column column-width="proportional-column-width(1)" column-number="2"/>
      <fo:table-column column-width="proportional-column-width(1)" column-number="3"/>
      <fo:table-column column-width="proportional-column-width(1)" column-number="4"/>
      <fo:table-body>
          <fo:table-cell border="1pt solid black" padding="2pt">
            <fo:block>e
            </fo:block>
          </fo:table-cell><fo:table-cell  border="1pt solid black"
            padding="2pt">
            <fo:block>a </fo:block>
          </fo:table-cell><fo:table-cell border="1pt solid black"
            padding="2pt">
            <fo:block>b </fo:block>
          </fo:table-cell><fo:table-cell border="1pt solid black"
            padding="2pt">
            <fo:block>
              <fo:inline wrap-option="wrap">
                c
              </fo:inline>
            </fo:block>
          </fo:table-cell>
      </fo:table-body>
    </fo:table>
    <fo:block>
      <!--
      <fo:instream-foreign-object content-width="scale-up-to-fit"
        content-height="scale-up-to-fit" scaling="non-uniform" height="100%" width="100%">
        <svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="1600px" height="1600px" viewbox="0 0 1600 1600" preserveAspectRatio="none">
          <svg:g>
            <svg:line x1="0" y1="0" x2="1600" y2="1600" style="stroke:blue;"/>
            <svg:line x1="0" y1="1600" x2="1600" y2="0" style="stroke:blue;"/>
          </svg:g>
        </svg:svg>
      </fo:instream-foreign-object>
      <fo:external-graphic content-width="scale-to-fit"
        content-height="scale-to-fit" scaling="non-uniform" width="100%" height="100%" src="xmlroff.svg"/>
      -->
      <fo:external-graphic content-width="scale-to-fit"
        content-height="scale-to-fit" scaling="non-uniform" width="100%" height="100%" src="cross.svg"/>
    </fo:block>
  </fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
------------------------------------------------------------

Regards,


Tony Graham                         Tony.Graham@MenteithConsulting.com
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd                               XML Guild member
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2
Received on Monday, 20 July 2009 17:07:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 20 July 2009 17:07:27 GMT