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 Muthukumar Rajaram <mu...@in.ibm.com> on 2004/03/08 08:38:20 UTC

Image size




 Hi,
I am generating a graph dynamically and placing it in the PDF by
construcing the fo file with the help of the tag "external-graphic".
The image is generated dynamically and the width and height varies. In the
width and height attributes, i am not able to give the exact value due to
this reason.
Any input in this...
Thanks and regards
Muthu


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


Re: Image size

Posted by Clay Leeds <cl...@medata.com>.
Chris,

On Mar 8, 2004, at 7:04 AM, Chris Bowditch wrote:
> Clay Leeds wrote:
> <snip/>
>> The workaround for me (with regard to the 72dpi image problem) has 
>> been to create a JPG with a resolution of 300dpi (note: large file 
>> size), and then scale the image down if necessary. This produces high 
>> resolution logos for placement in our FOP-rendered pages without 
>> pixelation.
>
> Clay - in order to scale the image down you need to specify a height 
> and width, and Muthukumar was saying that he couldnt specify them 
> because he didnt know them.
>
> <snip/>

Ahh! I misunderstood the portion:

> However, without width and height specified FOP outputs the image at 
> 72dpi.

Too true. Perhaps Muthukumar could specify either the height or the 
width, or could specify the content-height or the content-width to 
overcome this. At least specifying one of those values might help 
maintain a sense  of scale...

Thanks for the clarification!

Web Maestro Clay


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


Re: Image size

Posted by Chris Bowditch <bo...@hotmail.com>.
Clay Leeds wrote:

<snip/>

> The workaround for me (with regard to the 72dpi image problem) has been 
> to create a JPG with a resolution of 300dpi (note: large file size), and 
> then scale the image down if necessary. This produces high resolution 
> logos for placement in our FOP-rendered pages without pixelation.

Clay - in order to scale the image down you need to specify a height and 
width, and Muthukumar was saying that he couldnt specify them because he 
didnt know them.

<snip/>



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


Re: Image size

Posted by Clay Leeds <cl...@medata.com>.
On Mar 8, 2004, at 1:50 AM, Chris Bowditch wrote:
> Muthukumar Rajaram wrote:
>> I am generating a graph dynamically and placing it in the PDF by
>> construcing the fo file with the help of the tag "external-graphic".
>> The image is generated dynamically and the width and height varies. 
>> In the
>> width and height attributes, i am not able to give the exact value 
>> due to
>> this reason.
>> Any input in this...
>
> You dont actually state what your problem is. It isnt mandatory to 
> specify width and height on external-graphic. However, without width 
> and height specified FOP outputs the image at 72dpi. I guess your 
> problem is the quality of the image is very poor.
>
> There isnt a workaround in general.
>
> Chris

The workaround for me (with regard to the 72dpi image problem) has been 
to create a JPG with a resolution of 300dpi (note: large file size), 
and then scale the image down if necessary. This produces high 
resolution logos for placement in our FOP-rendered pages without 
pixelation.

Probably the most important thing to remember about adding 
external-graphics to FOP-rendered pages is this:

IIRC, FOP has a bug in it causing it to go into an infinite loop, if 
the graphic is too large to fit on a page.

Good luck!

Web Maestro Clay


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


Re: Image size

Posted by Clay Leeds <cl...@medata.com>.
On Mar 8, 2004, at 9:08 PM, Muthukumar Rajaram wrote:
> Hi,
> I hope Chris have understood my problem correctly. I am generating the
> graphs dynamically by calling a servlet which will generate the graph  
> for
> me.
> <fo:block>
> <fo:external-graphic content-type="image/gif" src=
> "url('http://localhost:8080/hr/exec/comp/personal/protect/ 
> {$imageUrl1}')"
> scaling="uniform"/>
> </fo:block>
> I have methods to get the height and width of the image that is  
> generated.
> But since from the xsl, i am calling a different http request, i don't  
> have
> the access to my methods. Depending on the data, the width and height  
> of
> the image is different.  I am not storing the image as a physical  
> file. It
> is dynamically generated by a servlet and flushed to the outputstream.  
> Is
> there any  way to get the image's height and witdth?. I want to place  
> the
> exact height and width. If I don't specify them then FOP outputs the  
> image
> at 72dpi and the quality of my image is very bad. I need to align two
> graphs adjacent to each other. Hence their width is a must.
> Your suggestions are greatly appreciated.
> Thanks and regards
> Muthu

I believe if you specify only the width, it will scale the height  
proportionately (I don't think you need to specify  
'scaling="uniform"'):

> <fo:block>
> <fo:external-graphic content-type="image/gif" width="12cm" src=
> "url('http://localhost:8080/hr/exec/comp/personal/protect/ 
> {$imageUrl1}')"/><fo:external-graphic content-type="image/gif"  
> width="12cm" src=
> "url('http://localhost:8080/hr/exec/comp/personal/protect/ 
> {$imageUrl2}')"/>
> </fo:block>

or specify content-width:

> <fo:block>
> <fo:external-graphic content-type="image/gif" content-width="12cm" src=
> "url('http://localhost:8080/hr/exec/comp/personal/protect/ 
> {$imageUrl1}')"/><fo:external-graphic content-type="image/gif"  
> content-width="12cm" src=
> "url('http://localhost:8080/hr/exec/comp/personal/protect/ 
> {$imageUrl2}')"/>
> </fo:block>

(try them both--one may work better than the other).

Hope this helps!

Web Maestro Clay


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


Re: Image size

Posted by Muthukumar Rajaram <mu...@in.ibm.com>.



Hi,
I hope Chris have understood my problem correctly. I am generating the
graphs dynamically by calling a servlet which will generate the graph for
me.
<fo:block>
<fo:external-graphic content-type="image/gif" src=
"url('http://localhost:8080/hr/exec/comp/personal/protect/{$imageUrl1}')"
scaling="uniform"/>
</fo:block>
I have methods to get the height and width of the image that is generated.
But since from the xsl, i am calling a different http request, i don't have
the access to my methods. Depending on the data, the width and height of
the image is different.  I am not storing the image as a physical file. It
is dynamically generated by a servlet and flushed to the outputstream. Is
there any  way to get the image's height and witdth?. I want to place the
exact height and width. If I don't specify them then FOP outputs the image
at 72dpi and the quality of my image is very bad. I need to align two
graphs adjacent to each other. Hence their width is a must.
Your suggestions are greatly appreciated.
Thanks and regards
Muthu
********************************************************
Muthukumar Rajaram, Senior Software Engineer
IBM Global Services India
II Floor, Prestige Towers
99, Residency Road, Bangalore - 560 025
Phone : 2073333 (or) 2079999 Extn : 2140
Fax : 2079010
E-mail : muthukra@in.ibm.com
Homepage : http://dear.to/muthu
********************************************************


                                                                                                                                       
                      Chris Bowditch                                                                                                   
                      <bowditch_chris@h        To:       fop-user@xml.apache.org                                                       
                      otmail.com>              cc:                                                                                     
                                               Subject:  Re: Image size                                                                
                      03/08/2004 03:20                                                                                                 
                      PM                                                                                                               
                      Please respond to                                                                                                
                      fop-user                                                                                                         
                                                                                                                                       



Muthukumar Rajaram wrote:

> I am generating a graph dynamically and placing it in the PDF by
> construcing the fo file with the help of the tag "external-graphic".
> The image is generated dynamically and the width and height varies. In
the
> width and height attributes, i am not able to give the exact value due to
> this reason.
> Any input in this...

You dont actually state what your problem is. It isnt mandatory to
specify width and height on external-graphic. However, without width and
height specified FOP outputs the image at 72dpi. I guess your problem is
the quality of the image is very poor.

There isnt a workaround in general.

Chris



---------------------------------------------------------------------
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: Image size

Posted by Chris Bowditch <bo...@hotmail.com>.
Muthukumar Rajaram wrote:

> I am generating a graph dynamically and placing it in the PDF by
> construcing the fo file with the help of the tag "external-graphic".
> The image is generated dynamically and the width and height varies. In the
> width and height attributes, i am not able to give the exact value due to
> this reason.
> Any input in this...

You dont actually state what your problem is. It isnt mandatory to 
specify width and height on external-graphic. However, without width and 
height specified FOP outputs the image at 72dpi. I guess your problem is 
the quality of the image is very poor.

There isnt a workaround in general.

Chris



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