W3C home > Mailing lists > Public > www-xsl-fo@w3.org > November 2006

Re: How to process xhtml form data into pdf document?

From: Werner Donné <werner.donne@re.be>
Date: Thu, 02 Nov 2006 11:10:00 +0100
Message-ID: <4549C3F8.5050400@re.be>
To: flexzor <michael.nielsen@capgemini.com>
Cc: www-xsl-fo@w3.org

Hi,

Here is an example generated with CSSToXSLFO:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
          xmlns:rx="http://www.renderx.com/XSL/Extensions"
          font-selection-strategy="character-by-character"
          line-height-shift-adjustment="disregard-shifts"
          country="GB"
          font-family="serif"
          font-size="11pt"
          language="en">
    <fo:layout-master-set>
       <fo:simple-page-master master-name="right-unnamed" 
writing-mode="lr-tb" page-height="297mm"
                              page-width="210mm"
                              margin-top="0"
                              margin-bottom="0"
                              margin-left="0"
                              margin-right="0">
          <fo:region-body xmlns:css="http://www.w3.org/1998/CSS" 
xmlns:xh="http://www.w3.org/1999/xhtml"
                          xmlns:sp="urn:be-re-css:specificity"/>
       </fo:simple-page-master>
       <fo:simple-page-master master-name="first-right-unnamed" 
writing-mode="lr-tb" page-height="297mm"
                              page-width="210mm"
                              margin-top="0"
                              margin-bottom="0"
                              margin-left="0"
                              margin-right="0">
          <fo:region-body xmlns:css="http://www.w3.org/1998/CSS" 
xmlns:xh="http://www.w3.org/1999/xhtml"
                          xmlns:sp="urn:be-re-css:specificity"/>
       </fo:simple-page-master>
       <fo:simple-page-master master-name="first-left-unnamed" 
writing-mode="lr-tb" page-height="297mm"
                              page-width="210mm"
                              margin-top="0"
                              margin-bottom="0"
                              margin-left="0"
                              margin-right="0">
          <fo:region-body xmlns:css="http://www.w3.org/1998/CSS" 
xmlns:xh="http://www.w3.org/1999/xhtml"
                          xmlns:sp="urn:be-re-css:specificity"/>
       </fo:simple-page-master>
       <fo:simple-page-master master-name="blank-right-unnamed" 
writing-mode="lr-tb" page-height="297mm"
                              page-width="210mm"
                              margin-top="0"
                              margin-bottom="0"
                              margin-left="0"
                              margin-right="0">
          <fo:region-body xmlns:css="http://www.w3.org/1998/CSS" 
xmlns:xh="http://www.w3.org/1999/xhtml"
                          xmlns:sp="urn:be-re-css:specificity"/>
       </fo:simple-page-master>
       <fo:simple-page-master master-name="left-unnamed" 
writing-mode="lr-tb" page-height="297mm"
                              page-width="210mm"
                              margin-top="0"
                              margin-bottom="0"
                              margin-left="0"
                              margin-right="0">
          <fo:region-body xmlns:css="http://www.w3.org/1998/CSS" 
xmlns:xh="http://www.w3.org/1999/xhtml"
                          xmlns:sp="urn:be-re-css:specificity"/>
       </fo:simple-page-master>
       <fo:simple-page-master master-name="blank-left-unnamed" 
writing-mode="lr-tb" page-height="297mm"
                              page-width="210mm"
                              margin-top="0"
                              margin-bottom="0"
                              margin-left="0"
                              margin-right="0">
          <fo:region-body xmlns:css="http://www.w3.org/1998/CSS" 
xmlns:xh="http://www.w3.org/1999/xhtml"
                          xmlns:sp="urn:be-re-css:specificity"/>
       </fo:simple-page-master>
       <fo:page-sequence-master master-name="unnamed">
          <fo:repeatable-page-master-alternatives>
             <fo:conditional-page-master-reference odd-or-even="odd" 
blank-or-not-blank="not-blank" page-position="first"
 
master-reference="first-right-unnamed"/>
             <fo:conditional-page-master-reference odd-or-even="even" 
blank-or-not-blank="not-blank" page-position="first"
 
master-reference="first-left-unnamed"/>
             <fo:conditional-page-master-reference odd-or-even="odd" 
blank-or-not-blank="not-blank" page-position="any"
 
master-reference="right-unnamed"/>
             <fo:conditional-page-master-reference odd-or-even="even" 
blank-or-not-blank="not-blank" page-position="any"
 
master-reference="left-unnamed"/>
             <fo:conditional-page-master-reference odd-or-even="odd" 
blank-or-not-blank="blank" page-position="any"
 
master-reference="blank-right-unnamed"/>
             <fo:conditional-page-master-reference odd-or-even="even" 
blank-or-not-blank="blank" page-position="any"
 
master-reference="blank-left-unnamed"/>
          </fo:repeatable-page-master-alternatives>
       </fo:page-sequence-master>
    </fo:layout-master-set>
    <fo:page-sequence format="1" master-reference="unnamed">
       <fo:static-content flow-name="xsl-footnote-separator">
          <fo:block xmlns:css="http://www.w3.org/1998/CSS">
             <fo:leader leader-length="41%" leader-pattern="rule" 
rule-style="solid"
                        rule-thickness="0.2pt"/>
          </fo:block>
       </fo:static-content>
       <fo:flow flow-name="xsl-region-body">
          <fo:block margin-left="0pt" margin-right="0pt" 
font-family="serif" line-height="1.33"
                    padding-bottom="0.0pt"
                    padding-left="0.0pt"
                    padding-right="0.0pt"
                    padding-top="0.0pt"
                    unicode-bidi="embed">
             <fo:block margin-left="0pt" margin-right="0pt" 
unicode-bidi="embed">
                <fo:external-graphic content-height="scale-to-fit" 
content-width="scale-to-fit" scaling="uniform"
 
src="url(file:/home/werner/background.png)"
                                     width="20cm"/>
                <fo:block-container space-after="0.83em" 
margin-left="0.0pt" margin-right="0.0pt"
                                    space-before="0.83em"
                                    top="4.0cm"
                                    left="4.0cm"
                                    absolute-position="absolute">
                   <fo:block margin-left="0pt" margin-right="0pt" 
text-align="justify" unicode-bidi="embed">This text goes on top
of the image</fo:block>
                </fo:block-container>
             </fo:block>
          </fo:block>
          <fo:block id="last-page"/>
       </fo:flow>
    </fo:page-sequence>
</fo:root>

Best regards,

Werner.

flexzor wrote:
> 
> Hi there
> 
> Could you come up with an example in xsl:fo format that does this?
> 
> /Michael
> 
> 
> Werner Donné wrote:
>>
>> Hi Michael,
>>
>> You can first format the image in an ordinary block and then place
>> the text using absolute positioning (position, top, left, ...). Normally
>> the text would be on top of the image. Note however that this is
>> implementation defined. You can fix it with the z-index property,
>> but not in FOP.
>>
>> Regards,
>>
>> Werner.
>>
>> flexzor wrote:
>>> Hi there
>>>  
>>> Im new to FOP and I have been searching the web for hours now trying to
>>> find
>>> a solution the the following challenge:
>>>  
>>> I have an XHTML file that consists of a scanned gif file and some html
>>> form
>>> fields that are positioned on the xhtml file using css where the
>>> positioning
>>> of of the fields are described. So if you open the xhtml file you can
>>> enter
>>> data directly.
>>>  
>>> My challege is how to transform this into xsl:fo?? I have tried to make a
>>> block use the image gif as background and render text on top of it but no
>>> luck. Only the part of the image that has text on it is shown. What i
>>> need
>>> is the full form image to be shown and then render the html form data on
>>> top
>>> of it in the correct positions. 
>>>  
>>> I have also tried to use the external-graphics tag to render the image
>>> but
>>> then I cant position data on top of it ;(.
>>>  
>>> So:
>>>  
>>> 1) Whats the best solution for rendering the full image and position data
>>> on
>>> top of it?
>>> 2) How to position data on top of the image file?
>>>  
>>> Thanx in advance!
>>>  
>>> See attached gif file to get an idea on my challenge.
>>>
>>> /Regards Michael
>>> http://www.nabble.com/file/3934/9110.gif 
>> -- 
>> Werner Donné  --  Re
>> Engelbeekstraat 8
>> B-3300 Tienen
>> tel: (+32) 486 425803	e-mail: werner.donne@re.be
>>
>>
>>
> 

-- 
Werner Donné  --  Re
Engelbeekstraat 8
B-3300 Tienen
tel: (+32) 486 425803	e-mail: werner.donne@re.be
Received on Thursday, 2 November 2006 10:10:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:14 GMT