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 macsmaker <ma...@aol.com> on 2007/10/25 23:43:11 UTC

external-graphic

Bear with me, I'm a newbie to FOP. I assure you I have search the web, and
all faqs I can find.

I'm using fop 0.20.5 and I'm trying to display a graphic in my PDF. I have
tried this (and appropriate variations):

 <fo:external-graphic
src="url('http://myserver/myapp/images/checked.jpg')"/>

I know the graphic is there, and is displayable. I don't get any errors. 
The rest of the PDF renders correctly. If I paste the url directly in my
browser the image is rendered correctly.

This does work:
 <fo:external-graphic src="url('file:d:///myapp/images/checked.jpg')"/>

I'm sure it's a problem referencing the image, just don't know what. I have
tried different file formats (.gif, .png, etc), no difference. Any ideas?

-- 
View this message in context: http://www.nabble.com/external-graphic-tf4693880.html#a13416727
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: external-graphic

Posted by "J.Pietschmann" <j3...@yahoo.de>.
macsmaker wrote:
> javax.servlet.ServletException: org.xml.sax.SAXParseException: Content is
> not allowed in prolog

This is not an issue with FOP, the error is produced by the XML parser
included in your Java environment. At least one 1.4 JDK release is known
to include an XML parser having a bug which may cause the problem above.
Upgrading to a more recent JDK release, at least to the latest 1.4
release, should fix the problem.
FOP 0.20.5 contained its own, even older XML parser, so you didn't
notice the problem there.

J.Pietschmann

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


RE: external-graphic

Posted by macsmaker <ma...@aol.com>.
Okay, I upgraded to 0.94 because I found other things that may be issues with
0.20.5. Now I'm completely hosed... Using the supplied FOP servlet, the same
xml and xsl files (i'm not using the fo option on the servlet) I get the
following error:

javax.servlet.ServletException: org.xml.sax.SAXParseException: Content is
not allowed in prolog
(I'm not going to include all the error info unless someone wants it.)

I have researched the problem and cannot find an answer to it. The only
"answers" I can find are: 
(1)incorrect coding on the xml declaration; (2)the xml file is not well
formed; (3)there are extraneous characters in the file.

I have made sure that my XML, XSL and any associated files I can find are
well formed, using UTF-8 for encoding, and no extraneous characters. I even
pared my XML file down to only a few elements and took out any unecessary
attributes. I have also looked at the web.xml supplied with distribution,
but don't see anything wrong with. Don't want to change it and potentially
make things worse.

No luck. I'm going back to 0.20.5 until I can figure this out.

-- 
View this message in context: http://www.nabble.com/external-graphic-tf4693880.html#a13475083
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: external-graphic

Posted by "ramkumar.m.v" <rk...@yahoo.com>.
Try setting the fop configuration.Your base dir isn't
set.So the fop doesn't know where to get the images
from.

(programmatic way):
org.apache.fop.configuration.Configuration.put("baseDir",getServletContext().getRealPath("/images/"));

The above code should be based in your java code
(typically a servlet),just befor calling your main
code that does the fop work.

The same can be set up in properties file too.Do a
google on
org.apache.fop.configuration.Configuration.put or
similar and you'll get tons of info.

The XSL would've something like:

<fo:external-graphic src="checked.jpg"/>

or

<fo:block><fo:external-graphic width="9pt"
height="12pt">
								     	<xsl:attribute name="src" ><xsl:value-of
select="imagename"/></xsl:attribute>

where "imagename" is the xml element (assuming you are
passing the data to xsl in the xml format) that
contains the value "checked.jpg"

Alternate option:

<fo:external-graphic
src="http://myserver/myapp/RenderImageServlet?fileName=File12848910.jpg"
width="9pt" height="12pt"></fo:external-graphic>

Dynamically stream images via a servlet and place that
content into fo:external-graphic as indicated above.

More info at:
http://java.webdeveloper.com/tutorials/FOP/article.html

Pick and choose any option that works for you

Ram

--- macsmaker <ma...@aol.com> wrote:

> 
> Bear with me, I'm a newbie to FOP. I assure you I
> have search the web, and
> all faqs I can find.
> 
> I'm using fop 0.20.5 and I'm trying to display a
> graphic in my PDF. I have
> tried this (and appropriate variations):
> 
>  <fo:external-graphic
>
src="url('http://myserver/myapp/images/checked.jpg')"/>
> 
> I know the graphic is there, and is displayable. I
> don't get any errors. 
> The rest of the PDF renders correctly. If I paste
> the url directly in my
> browser the image is rendered correctly.
> 
> This does work:
>  <fo:external-graphic
> src="url('file:d:///myapp/images/checked.jpg')"/>
> 
> I'm sure it's a problem referencing the image, just
> don't know what. I have
> tried different file formats (.gif, .png, etc), no
> difference. Any ideas?
> 
> -- 
> View this message in context:
>
http://www.nabble.com/external-graphic-tf4693880.html#a13416727
> Sent from the FOP - Users mailing list archive at
> Nabble.com.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail:
> fop-users-help@xmlgraphics.apache.org
> 
> 


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