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 Patrick JUSSEAU <pa...@openbase.com> on 2003/11/13 10:22:43 UTC

Problem with inserting images

Hi everyone,

I just started using XSL-FO and fop. I am trying to generate a pdf file 
which contains jpg files. Those images are always inserted in a parent 
component (I guess something like a viewport). I need to set a height 
for this viewport (view_height).

I need to be able to display them in the following 2 cases:

case 1: the image's height is greater than view_height. In that case 
the image has to scale in order to fit in its view_height. I succeeded 
in doing that. I did something like (where 100px is the height of my 
viewport):

<fo:block background-color="white" text-align="center">
	<fo:external-graphic content-height="100px" height="100px" 
src="url(image.jpg)"/>
</fo:block>



case 2: if view_height is greater than the image's height, then I want 
to display the image at its actual size and display it at the center of 
its viewport. Doing something like this does not work:

<fo:block background-color="white" text-align="center">
	<fo:external-graphic content-height="25px" height="100px" 
src="url(image.jpg)"/>
</fo:block>

--------------------
|	__________     |
|   |         |     |
|   |  image  |     |
|   ___________     |
|___________________|

What I am missing? Thanks for any help.

Patrick


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


RE: Problem with inserting images [more on problem]

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Patrick JUSSEAU [mailto:patrick@openbase.com]
>
> And the winner is..... Andreas!
> Indeed setting the line-height made the trick. My block now has a 100
> pixel size!
>
> Thanks again for all of you who helped me.
>

Just be careful that the fo:external-graphic is the only child of the
fo:block in question... Every new line of text entered in there (or any
fo:inline, which might trigger a line-break) will add a new line with
height="100px"...


Cheerz,

Andreas


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


Re: Problem with inserting images [more on problem]

Posted by Patrick JUSSEAU <pa...@openbase.com>.
And the winner is..... Andreas!
Indeed setting the line-height made the trick. My block now has a 100 
pixel size!

Thanks again for all of you who helped me.

Patrick


On 13 Nov 2003, at 10:55 AM, Andreas L. Delmelle wrote:

>> -----Original Message-----
>> From: Patrick JUSSEAU [mailto:patrick@openbase.com]
>>
>> Daniel,
>>
>> I tried that too with no success. This brings the following question.
>> How can I create an empty block with a specified height and width? If 
>> I
>> could create such a block I could embed my image in it.
>>
>
> Ok, another go... Try :
>
> <fo:block line-height="100px" display-align="center" ...>
>   <fo:external-graphic height="25px" />
> </fo:block>
>
> Apart from that: Chris is right, the content-width and content-height 
> props
> have not been implemented yet.
>
>
> Greetz,
>
> Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>


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


RE: Problem with inserting images [more on problem]

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Patrick JUSSEAU [mailto:patrick@openbase.com]
>
> Daniel,
>
> I tried that too with no success. This brings the following question.
> How can I create an empty block with a specified height and width? If I
> could create such a block I could embed my image in it.
>

Ok, another go... Try :

<fo:block line-height="100px" display-align="center" ...>
  <fo:external-graphic height="25px" />
</fo:block>

Apart from that: Chris is right, the content-width and content-height props
have not been implemented yet.


Greetz,

Andreas


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


Re: Problem with inserting images [more on problem]

Posted by Patrick JUSSEAU <pa...@openbase.com>.
Daniel,

I tried that too with no success. This brings the following question. 
How can I create an empty block with a specified height and width? If I 
could create such a block I could embed my image in it.

Patrick


On 13 Nov 2003, at 10:48 AM, Daniel Easton wrote:

> Can you set the height in the block level itself ?
>
> <fo:block background-color="white" display-align="center" 
> height="100px">
>     <fo:external-graphic src="..." height="25px" />
> </fo:block>
>
> Daniel
>
> ----- Original Message -----
> From: "Patrick JUSSEAU" <pa...@openbase.com>
> To: <fo...@xml.apache.org>
> Sent: Thursday, November 13, 2003 9:43 AM
> Subject: Re: Problem with inserting images [more on problem]
>
>
>> Hi,
>>
>> Just to be a little bit more specific about my previous post, I should
>> clarify what happens when using:
>>> <fo:block background-color="white" text-align="center">
>>> <fo:external-graphic content-height="25px" height="100px"
>>> src="url(image.jpg)"/>
>>> </fo:block>
>>
>> When using this code, my image has the correct size (25 pixel in
>> height) however the viewport height is not 100 pixel (it actually 
>> looks
>> like the viewport height = the image's height. I also tried using
>> 'display-align="center"' on the surrounding fo:block but this does not
>> work (it even makes things worse since now the image is not align
>> anymore). What I really want to do is getting a image at its actual
>> size at the center of a bigger empty block.
>>
>> Any ideas of how to accomplish this?
>>
>> Thanks,
>> Patrick
>>
>>
>>
>> On 13 Nov 2003, at 10:22 AM, Patrick JUSSEAU wrote:
>>
>>> Hi everyone,
>>>
>>> I just started using XSL-FO and fop. I am trying to generate a pdf
>>> file which contains jpg files. Those images are always inserted in a
>>> parent component (I guess something like a viewport). I need to set a
>>> height for this viewport (view_height).
>>>
>>> I need to be able to display them in the following 2 cases:
>>>
>>> case 1: the image's height is greater than view_height. In that case
>>> the image has to scale in order to fit in its view_height. I 
>>> succeeded
>>> in doing that. I did something like (where 100px is the height of my
>>> viewport):
>>>
>>> <fo:block background-color="white" text-align="center">
>>> <fo:external-graphic content-height="100px" height="100px"
>>> src="url(image.jpg)"/>
>>> </fo:block>
>>>
>>>
>>>
>>> case 2: if view_height is greater than the image's height, then I 
>>> want
>>> to display the image at its actual size and display it at the center
>>> of its viewport. Doing something like this does not work:
>>>
>>> <fo:block background-color="white" text-align="center">
>>> <fo:external-graphic content-height="25px" height="100px"
>>> src="url(image.jpg)"/>
>>> </fo:block>
>>>
>>> --------------------
>>> | __________     |
>>> |   |         |     |
>>> |   |  image  |     |
>>> |   ___________     |
>>> |___________________|
>>>
>>> What I am missing? Thanks for any help.
>>>
>>> Patrick
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
>>> For additional commands, e-mail: fop-user-help@xml.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
>> For additional commands, e-mail: fop-user-help@xml.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>


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


Re: Problem with inserting images [more on problem]

Posted by Daniel Easton <da...@acidy.com>.
Can you set the height in the block level itself ?

<fo:block background-color="white" display-align="center" height="100px">
    <fo:external-graphic src="..." height="25px" />
</fo:block>

Daniel

----- Original Message ----- 
From: "Patrick JUSSEAU" <pa...@openbase.com>
To: <fo...@xml.apache.org>
Sent: Thursday, November 13, 2003 9:43 AM
Subject: Re: Problem with inserting images [more on problem]


> Hi,
> 
> Just to be a little bit more specific about my previous post, I should 
> clarify what happens when using:
> > <fo:block background-color="white" text-align="center">
> > <fo:external-graphic content-height="25px" height="100px" 
> > src="url(image.jpg)"/>
> > </fo:block>
> 
> When using this code, my image has the correct size (25 pixel in 
> height) however the viewport height is not 100 pixel (it actually looks 
> like the viewport height = the image's height. I also tried using 
> 'display-align="center"' on the surrounding fo:block but this does not 
> work (it even makes things worse since now the image is not align 
> anymore). What I really want to do is getting a image at its actual 
> size at the center of a bigger empty block.
> 
> Any ideas of how to accomplish this?
> 
> Thanks,
> Patrick
> 
> 
> 
> On 13 Nov 2003, at 10:22 AM, Patrick JUSSEAU wrote:
> 
> > Hi everyone,
> >
> > I just started using XSL-FO and fop. I am trying to generate a pdf 
> > file which contains jpg files. Those images are always inserted in a 
> > parent component (I guess something like a viewport). I need to set a 
> > height for this viewport (view_height).
> >
> > I need to be able to display them in the following 2 cases:
> >
> > case 1: the image's height is greater than view_height. In that case 
> > the image has to scale in order to fit in its view_height. I succeeded 
> > in doing that. I did something like (where 100px is the height of my 
> > viewport):
> >
> > <fo:block background-color="white" text-align="center">
> > <fo:external-graphic content-height="100px" height="100px" 
> > src="url(image.jpg)"/>
> > </fo:block>
> >
> >
> >
> > case 2: if view_height is greater than the image's height, then I want 
> > to display the image at its actual size and display it at the center 
> > of its viewport. Doing something like this does not work:
> >
> > <fo:block background-color="white" text-align="center">
> > <fo:external-graphic content-height="25px" height="100px" 
> > src="url(image.jpg)"/>
> > </fo:block>
> >
> > --------------------
> > | __________     |
> > |   |         |     |
> > |   |  image  |     |
> > |   ___________     |
> > |___________________|
> >
> > What I am missing? Thanks for any help.
> >
> > Patrick
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: fop-user-help@xml.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
> 
> 
> 

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


Re: Problem with inserting images [more on problem]

Posted by Patrick JUSSEAU <pa...@openbase.com>.
Hi,

Just to be a little bit more specific about my previous post, I should 
clarify what happens when using:
> <fo:block background-color="white" text-align="center">
> 	<fo:external-graphic content-height="25px" height="100px" 
> src="url(image.jpg)"/>
> </fo:block>

When using this code, my image has the correct size (25 pixel in 
height) however the viewport height is not 100 pixel (it actually looks 
like the viewport height = the image's height. I also tried using 
'display-align="center"' on the surrounding fo:block but this does not 
work (it even makes things worse since now the image is not align 
anymore). What I really want to do is getting a image at its actual 
size at the center of a bigger empty block.

Any ideas of how to accomplish this?

Thanks,
Patrick



On 13 Nov 2003, at 10:22 AM, Patrick JUSSEAU wrote:

> Hi everyone,
>
> I just started using XSL-FO and fop. I am trying to generate a pdf 
> file which contains jpg files. Those images are always inserted in a 
> parent component (I guess something like a viewport). I need to set a 
> height for this viewport (view_height).
>
> I need to be able to display them in the following 2 cases:
>
> case 1: the image's height is greater than view_height. In that case 
> the image has to scale in order to fit in its view_height. I succeeded 
> in doing that. I did something like (where 100px is the height of my 
> viewport):
>
> <fo:block background-color="white" text-align="center">
> 	<fo:external-graphic content-height="100px" height="100px" 
> src="url(image.jpg)"/>
> </fo:block>
>
>
>
> case 2: if view_height is greater than the image's height, then I want 
> to display the image at its actual size and display it at the center 
> of its viewport. Doing something like this does not work:
>
> <fo:block background-color="white" text-align="center">
> 	<fo:external-graphic content-height="25px" height="100px" 
> src="url(image.jpg)"/>
> </fo:block>
>
> --------------------
> |	__________     |
> |   |         |     |
> |   |  image  |     |
> |   ___________     |
> |___________________|
>
> What I am missing? Thanks for any help.
>
> Patrick
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>


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


RE: Problem with inserting images

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
>
> Not that display-align works only on reference areas (table cells,
> fo:block-container and regions). Also, you can only set a height
> on table rows and block containers (wont work on ordinary blocks
> or table cells).
>

Still... what would be the pitfall in using 'line-height="100px"' on the
surrounding fo:block?
I guess 'display-align="center"' is being ignored when put on the fo:block
(?) (So he could actually just leave that out).
Are the images automatically centered vertically on the current line? (So
setting the line-height works perfectly in this case, but *could* raise
problems when you need the image aligned at the top of the line? In which
case, Chris' table approach will probably work much better...)


Just some random thoughts...

Cheerz,

Andreas


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


Re: Problem with inserting images

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Patrick JUSSEAU wrote:
> I just started using XSL-FO and fop. I am trying to generate a pdf file 
> which contains jpg files. Those images are always inserted in a parent 
> component (I guess something like a viewport). I need to set a height 
> for this viewport (view_height).
...
> What I am missing? Thanks for any help.

Check
  http://xml.apache.org/fop/fo.html#fo-center-vertical

Not that display-align works only on reference areas (table cells,
fo:block-container and regions). Also, you can only set a height
on table rows and block containers (wont work on ordinary blocks
or table cells).

J.Pietschmann



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


RE: Problem with inserting images

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Patrick JUSSEAU [mailto:patrick@openbase.com]
>
<snip/>
>
> case 2: if view_height is greater than the image's height, then I want
> to display the image at its actual size and display it at the center of
> its viewport. Doing something like this does not work:
>
> <fo:block background-color="white" text-align="center">
> 	<fo:external-graphic content-height="25px" height="100px"
> src="url(image.jpg)"/>
> </fo:block>
>

Hi,

Try using 'display-align="center"' on the surrounding fo:block.

<fo:block background-color="white" text-align="center"
display-align="center">
  <fo:external-graphic .../>
</fo:block>


Hope this helps!

Greetz,

Andreas


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