Rito Sarkar
Rito Sarkar

Reputation: 69

How to evaluate the width that got allocated for the Image In XSLT Rendering With FOP-2.8

In order to render a PNG file I am trying below code snippets;

  1. Rendering the image at the header inside a table where (width of the available view port < content-width) :

Page definition:

<fo:simple-page-master master-name="page-one" page-width="297mm" page-height="210mm" margin="12mm">
     <fo:region-body margin-bottom="5mm" margin-right="63.85mm"/>
     <fo:region-before extent="186.9mm" region-name="page-one-header"/>
     <fo:region-after extent="5mm" region-name="page-one-footer"/>
</fo:simple-page-master>

Here as per my understanding width of the available view port area for my header will be 63.85mm;

 <fo:table table-layout="fixed" width="100%">
    <fo:table-column column-width="proportional-column-width(4.6)"/>
    <fo:table-column column-width="proportional-column-width(0.9)"/>
     <fo:table-body>
      <fo:table-row>
        <fo:table-cell column-number="2">
          <fo:block>
            <fo:external-graphic src="file:///{$Logo}/Img.png" content-height="16mm" content-width="44mm" scaling="non-uniform"/>
          </fo:block>
        </fo:table-cell>
       </fo:table-row>
      </fo:table-body>
</fo:table>

Hence width for column 2 will boils down to ~ 10.448mm < content-width="44mm"

  1. Rendering the image at the header inside a table where (width of the available view port > content-width) :

Page two definition:

<fo:simple-page-master master-name="page-two-page" page-width="297mm" page-height="210mm" margin="12mm">
   <fo:region-body margin-top="18.5mm" margin-bottom="5mm"/>
   <fo:region-before extent="18.5mm"  region-name="page-two-header"/>
   <fo:region-after extent="5mm" region-name="page-two-footer"/>
</fo:simple-page-master>

Here as per my understanding width of the available view port area for my header will be 273mm; and we are creating a reference area:

<fo:table table-layout="fixed" width="100%">
   <fo:table-column column-width="proportional-column-width(2)" />
   <fo:table-column column-width="proportional-column-width(2.6)" />
   <fo:table-column column-width="proportional-column-width(1)" />

     <fo:table-body>
      <fo:table-row >
       <fo:table-cell column-number="3">
        <fo:block>
         <fo:external-graphic src="file:///{$Logo}/Img.png" content-height="16mm" content-width="45mm" scaling="non-uniform"/>
          </fo:block>
         </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
</fo:table>

As per my understanding allocated width for column 3 will be 48.75mm > content-width="45mm"

In terms of logo to be displayed there is no such differences.

So now what should I consider as actual width that is being allocated for the images in both the cases? Available view port width or the content width ? Also what will be area in such cases ?

Upvotes: 0

Views: 64

Answers (0)

Related Questions