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 Torsten Buslei <To...@heuft.com> on 2003/11/21 09:59:50 UTC
PDF-Report with dynamic JPEG-Image
Hello,
I'm using FOP (0.20.5) for several month. It's a nice tool to generate
dynamic pdf-documents in a web-environment (tomcat 4, java 1.4.1).
Now I want to integrate charts which I generate in a servlet powered by the
JFreeChart-classes (an open source project). The response of the servlet is
"image/jpeg". I use it on a html-site in an image-tag.
I thought it must be easy to use the fop-image-tag to reference this dynamic
image on the pdf-page like:
<fo:external-graphic
src="url('http://localhost/myapp/servlet/myimageservlet')" width="570"/>
But no graphic is shown in my pdf-result.
If I put the URL in the address-bar of my browser, the image is shown. Then
I've saved the image (104 kB) on hard disk and referenced it absolute in the
fo-document. Now I see the result as expected. But I still have to generate
the jpeg-image dynamically ;-(
Some searches in the log's only shows one little error without any other
messages: HTTP-ERROR 302 (FOUND)
w3.org describes this error as:
"10.3.3 302 Found
The requested resource resides temporarily under a different URI. Since the
redirection might be altered on occasion, the client SHOULD continue to use
the Request-URI for future requests. This response is only cacheable if
indicated by a Cache-Control or Expires header field.
The temporary URI SHOULD be given by the Location field in the response.
Unless the request method was HEAD, the entity of the response SHOULD
contain a short hypertext note with a hyperlink to the new URI(s).
If the 302 status code is received in response to a request other than GET
or HEAD, the user agent MUST NOT automatically redirect the request unless
it can be confirmed by the user, since this might change the conditions
under which the request was issued. "
Does anybody knows what I'm doing wrong? Is it possible to referance an
external image with a http-URL? Does someone use such dynamic images?
Thanks in advance,
Torsten
Re: PDF-Report with dynamic JPEG-Image
Posted by Chris Pratt <ch...@planetpratt.com>.
I'd bet, since your url doesn't have an extension, you have to include the content-type="image/jpeg" attribute. You might try:
<fo:external-graphic content-type="image/jpeg"
src="url('http://localhost/myapp/servlet/myimageservlet')" width="570"/>
(*Chris*)
----- Original Message -----
From: Torsten Buslei
To: fop-user@xml.apache.org
Sent: Friday, November 21, 2003 12:59 am
Subject: PDF-Report with dynamic JPEG-Image
Hello,
I'm using FOP (0.20.5) for several month. It's a nice tool to generate
dynamic pdf-documents in a web-environment (tomcat 4, java 1.4.1).
Now I want to integrate charts which I generate in a servlet powered by the
JFreeChart-classes (an open source project). The response of the servlet is
"image/jpeg". I use it on a html-site in an image-tag.
I thought it must be easy to use the fop-image-tag to reference this dynamic
image on the pdf-page like:
<fo:external-graphic
src="url('http://localhost/myapp/servlet/myimageservlet')" width="570"/>
But no graphic is shown in my pdf-result.
If I put the URL in the address-bar of my browser, the image is shown. Then
I've saved the image (104 kB) on hard disk and referenced it absolute in the
fo-document. Now I see the result as expected. But I still have to generate
the jpeg-image dynamically ;-(
Some searches in the log's only shows one little error without any other
messages: HTTP-ERROR 302 (FOUND)
w3.org describes this error as:
"10.3.3 302 Found
The requested resource resides temporarily under a different URI. Since the
redirection might be altered on occasion, the client SHOULD continue to use
the Request-URI for future requests. This response is only cacheable if
indicated by a Cache-Control or Expires header field.
The temporary URI SHOULD be given by the Location field in the response.
Unless the request method was HEAD, the entity of the response SHOULD
contain a short hypertext note with a hyperlink to the new URI(s).
If the 302 status code is received in response to a request other than GET
or HEAD, the user agent MUST NOT automatically redirect the request unless
it can be confirmed by the user, since this might change the conditions
under which the request was issued. "
Does anybody knows what I'm doing wrong? Is it possible to referance an
external image with a http-URL? Does someone use such dynamic images?
Thanks in advance,
Torsten
Re: PDF-Report with dynamic JPEG-Image
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Torsten Buslei wrote:
> Now I want to integrate charts which I generate in a servlet powered by the
> JFreeChart-classes (an open source project). The response of the servlet is
> "image/jpeg". I use it on a html-site in an image-tag.
...
> <fo:external-graphic
> src="url('http://localhost/myapp/servlet/myimageservlet')" width="570"/>
>
The URL doesn't look very dynamic to me. Check whether the generating
servlet checks for cookies or a specific user agent. A way to do this
is to download the image using wget.
> Is it possible to referance an
> external image with a http-URL? Does someone use such dynamic images?
Yes and yes.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org