You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Sun, Tiffany (Tong)" <TS...@AAS.com> on 2005/04/18 22:04:56 UTC

RE: FOP - external-graphic in absolutely positioned block contain er.

If you are using FOP-0.20.5, the content-width and content-height will do
nothing to your external-graphic, since they are not implemented in this
version.
You can use width and height to control the image size.
When you increase the width of the block-container and the image
disappeared, it's still get transformed, but only in the page trailer part,
that's why it's never showed up in your page. When an image is too big to
fit in the block, and you did not provide width and height, that's the
behavior in 0.20.5, at least that's what happened to all my images.
But there will be one more problem if you provide width and height, unless
you provide width and height with the same ratio with your original image,
it will become weird on your page. I had to modify part of that code, to
scan the image down to block size, while keep the ratio, if that image is
too big.   


-----Original Message-----
From: Mike Trotman [mailto:mike.trotman@datalucid.com] 
Sent: Monday, April 18, 2005 3:04 PM
To: fop-users@xmlgraphics.apache.org
Subject: FOP - external-graphic in absolutely positioned block container.

I have what seems like some weird inconsistent when trying to use 
block-container to absolutely position a graphic.
(This is often a sign that one is doing something stupid - and a fresh 
pair of eyes can help.)

The code below works OK (at least it shows the graphic - I still have to 
adjust the size properly use consistent and proper units).

     37 <fo:static-content flow-name="xsl-region-before">
     38 <fo:block-container position="absolute" top="0cm" left="0.0cm" 
height="20.5cm" width="28cm" border="1px solid silver"/>
     39 <fo:block-container position='absolute' top='3cm' left='3cm' 
height='3in' width='2in' border='3px solid blue'>
     40 <fo:block><fo:external-graphic src='url(images/img_2.jpg)' 
content-height='0.5in' content-width='0.5in'/> </fo:block>
     41 <fo:block text-align='right' color='red' 
background-color='yellow'>XbeforeX</fo:block>
     42 </fo:block-container>
     43 </fo:static-content>
     44

However if I INCREASE the width of the block-container in line 39 to 2.5in

    39 <fo:block-container position='absolute' top='3cm' left='3cm' 
height='3in' width='2.5in' border='3px solid blue'>

then the image is NOT displayed!
It is as if it was never there - i.e. the next block is displayed as the 
1st line.

Does anyone have any clue as to why this is happening - or what I am 
doing wrong?

Mike

P.S. I've also encountered some non-intuitive positioning behaviour when 
using xsl-region-end or xsl-region-after.

The origins for absolute position seem to be relative to the top LH 
corner of the relevant region.
(at least with the extents I am using.)

Is this correct behaviour?

E.g.
To get something on the visible page in xsl-region-afterr you have to 
specify a 'top' value < 0.

<fo:static-content flow-name='xsl-region-after'>
<fo:block-container position='absolute' top='-16cm' left='2cm' 
height='3in' width='2in' border='3px solid yellow'>
<fo:block><fo:external-graphic src='url(img_2.jpg)' 
content-height='1.5in' content-width='1.5in'/> </fo:block>
<fo:block text-align='right' color='yellow'>after</fo:block>
</fo:block-container>
</fo:static-content>



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 18/04/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org