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 John Brown <jo...@hotmail.com> on 2008/08/07 18:43:23 UTC

Adding support for PDF images to FOP

Hello All,

I had this working on a Linux computer to which I do not
have access right now. I was running fop-trunk.

I have reconstructed my DocBook, xmllint/xsltproc and FOP
environment on a Windows XP computer, but I cannot get
FOP-0.95 (Release) to accept PDF as images:

Aug 7, 2008 11:27:52 AM org.apache.fop.fo.flow.ExternalGraphic bind
SEVERE: Image not available: No ImagePreloader found for images/capex.pdf
Aug 7, 2008 11:27:52 AM org.apache.fop.render.pdf.PDFRenderer putImage
SEVERE: Image not found: images/capex.pdf

I downloaded the fop-pdf-images archive at
http://www.jeremias-maerki.ch/download/fop/pdf-images/fop-pdf-images-1.2-
bin.zip.

I put the jar files in fop-0.95\build where fop.jar is located.
That did not work, so I also copied them to fop-0.95\lib.

JAR files in fop-0.95\lib:

avalon-framework-4.2.0.jar
batik-all-1.7.jar
commons-io-1.3.1.jar
commons-logging-1.0.4.jar
fop-hyph.jar
fop-pdf-images-1.2-res.jar
fop-pdf-images-1.2.jar
PDFBox-0.7.4-dev.jar
serializer-2.7.0.jar
xalan-2.7.0.jar
xercesImpl-2.7.1.jar
xml-apis-1.3.04.jar
xml-apis-ext-1.3.04.jar
xmlgraphics-commons-1.3.1.jar

JAR files in fop-0.95\build:
fop-hyph.jar
fop-pdf-images-1.2-res.jar
fop-pdf-images-1.2.jar
fop.jar
PDFBox-0.7.4-dev.jar

I am using fop-0.95 (Release).
What am I doing wrong?


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


RE: Adding support for PDF images to FOP

Posted by John Brown <jo...@hotmail.com>.

Jeremias Maerki wrote:

>
> I have verified that version 1.2 still works with FOP 0.95.
>
> If you get the message "No ImagePreloader found for *.pdf" it means that
> the plug-in isn't in the classpath. Please note that on Windows, it's
> not enough to put some JARs in FOP's lib directory if you use fop.bat.
> You'll have to edit this file and add the two JARs
> (fop-pdf-images-1.2.jar and PDFBox-0.7.4-dev.jar). fop.cmd is a little
> smarter as is the shell script on Unixes.
>

That fixed it. I really should have tried that. Anyway, thanks.

By the way, there is no fop.cmd in fop-0.95-bin.zip; only fop and fop.bat.



_________________________________________________________________
Reveal your inner athlete and share it with friends on Windows Live.
http://revealyourinnerathlete.windowslive.com?locale=en-us&ocid=TXT_TAGLM_WLYIA_whichathlete_us
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Adding support for PDF images to FOP

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
I have verified that version 1.2 still works with FOP 0.95.

If you get the message "No ImagePreloader found for *.pdf" it means that
the plug-in isn't in the classpath. Please note that on Windows, it's
not enough to put some JARs in FOP's lib directory if you use fop.bat.
You'll have to edit this file and add the two JARs
(fop-pdf-images-1.2.jar and PDFBox-0.7.4-dev.jar). fop.cmd is a little
smarter as is the shell script on Unixes.

BTW, you don't need to add the fop-pdf-images-1.2-res.jar. It only
contains some resources I needed during development. They shouldn't have
been included in the distribution. It was an oversight on my part.

On 07.08.2008 18:43:23 John Brown wrote:
> Hello All,
> 
> I had this working on a Linux computer to which I do not
> have access right now. I was running fop-trunk.
> 
> I have reconstructed my DocBook, xmllint/xsltproc and FOP
> environment on a Windows XP computer, but I cannot get
> FOP-0.95 (Release) to accept PDF as images:
> 
> Aug 7, 2008 11:27:52 AM org.apache.fop.fo.flow.ExternalGraphic bind
> SEVERE: Image not available: No ImagePreloader found for images/capex.pdf
> Aug 7, 2008 11:27:52 AM org.apache.fop.render.pdf.PDFRenderer putImage
> SEVERE: Image not found: images/capex.pdf
> 
> I downloaded the fop-pdf-images archive at
> http://www.jeremias-maerki.ch/download/fop/pdf-images/fop-pdf-images-1.2-
> bin.zip.
> 
> I put the jar files in fop-0.95\build where fop.jar is located.
> That did not work, so I also copied them to fop-0.95\lib.
> 
> JAR files in fop-0.95\lib:
> 
> avalon-framework-4.2.0.jar
> batik-all-1.7.jar
> commons-io-1.3.1.jar
> commons-logging-1.0.4.jar
> fop-hyph.jar
> fop-pdf-images-1.2-res.jar
> fop-pdf-images-1.2.jar
> PDFBox-0.7.4-dev.jar
> serializer-2.7.0.jar
> xalan-2.7.0.jar
> xercesImpl-2.7.1.jar
> xml-apis-1.3.04.jar
> xml-apis-ext-1.3.04.jar
> xmlgraphics-commons-1.3.1.jar
> 
> JAR files in fop-0.95\build:
> fop-hyph.jar
> fop-pdf-images-1.2-res.jar
> fop-pdf-images-1.2.jar
> fop.jar
> PDFBox-0.7.4-dev.jar
> 
> I am using fop-0.95 (Release).
> What am I doing wrong?
> 



Jeremias Maerki


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


RE: Location of external graphics

Posted by Pete Allison <ma...@aol.com>.
Thanks. We will give a go. 

-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Thursday, August 07, 2008 1:29 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Location of external graphics

The Java example from the Wiki page is updated now.

On 07.08.2008 20:16:28 Jeremias Maerki wrote:
> Bundling the stylesheets in the WAR file is one solution that many 
> users seem to be using. Another could be using a XML Catalog (using 
> XML Commons Resolver from the Apache XML project). More information on 
> the resolver here:
> http://xml.apache.org/commons/components/resolver/index.html
> http://wiki.apache.org/xmlgraphics-fop/HowTo/XmlCommonsResolver
> 
> With an XML Catalog you could do things like rewriting URIs like:
> myresources:xslt/mystylesheet.xslt
> to:
> file:/home/user/resources/xslt/mystylesheet.xslt
> 
> The XML Commons Resolver implements both the EntityResolver and 
> URIResolver interfaces. In FOP, you can configure your own URIResolver.
> However, the Java example on the Wiki page above (as I had to notice 
> now) is hopelessly outdated. I'll see to it that it is updated.
> 
> Yet another way is to just set the base URI on the FopFactory to 
> something you define. But then you're still using relative filenames.
> Not that this is bad in any way. But it can be hard to debug.
> 
> HTH
> 
> On 07.08.2008 19:16:18 Pete Allison wrote:
> > This may not be the appropriate forum (may be more of a Java 
> > question), so I asked for your forbearance.
> > 
> > We are struggling with where to keep our image files. Right now we 
> > loading them with absolute file paths. This works for one application
that "builds"
> > the path based on environment information. This allows us to 
> > maintain portability.
> > 
> > We have another application that does not know anything about its 
> > environment. When the application is moved from a development server 
> > to a production, we must update the stylesheet to reflect the server 
> > change. We would like to avoid this.
> > 
> > It appears that file references, if not absolute, are relative to 
> > the (and here's the part we are a little fuzzy on) the classpath for our
FOP servlet?
> > 
> > 
> > If this is the case, I guess we can put them in the WAR file and 
> > then redistribute it as needed. I was hoping for a cleaner solution.
> > 
> > Thanks,
> > Pete Allison
> >  
> 
> 
> 



Jeremias Maerki


---------------------------------------------------------------------
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


Re: Location of external graphics

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
The Java example from the Wiki page is updated now.

On 07.08.2008 20:16:28 Jeremias Maerki wrote:
> Bundling the stylesheets in the WAR file is one solution that many users
> seem to be using. Another could be using a XML Catalog (using XML
> Commons Resolver from the Apache XML project). More information on the
> resolver here:
> http://xml.apache.org/commons/components/resolver/index.html
> http://wiki.apache.org/xmlgraphics-fop/HowTo/XmlCommonsResolver
> 
> With an XML Catalog you could do things like rewriting URIs like:
> myresources:xslt/mystylesheet.xslt
> to:
> file:/home/user/resources/xslt/mystylesheet.xslt
> 
> The XML Commons Resolver implements both the EntityResolver and
> URIResolver interfaces. In FOP, you can configure your own URIResolver.
> However, the Java example on the Wiki page above (as I had to notice now)
> is hopelessly outdated. I'll see to it that it is updated.
> 
> Yet another way is to just set the base URI on the FopFactory to
> something you define. But then you're still using relative filenames.
> Not that this is bad in any way. But it can be hard to debug.
> 
> HTH
> 
> On 07.08.2008 19:16:18 Pete Allison wrote:
> > This may not be the appropriate forum (may be more of a Java question), so I
> > asked for your forbearance.
> > 
> > We are struggling with where to keep our image files. Right now we loading
> > them with absolute file paths. This works for one application that "builds"
> > the path based on environment information. This allows us to maintain
> > portability. 
> > 
> > We have another application that does not know anything about its
> > environment. When the application is moved from a development server to a
> > production, we must update the stylesheet to reflect the server change. We
> > would like to avoid this. 
> > 
> > It appears that file references, if not absolute, are relative to the (and
> > here's the part we are a little fuzzy on) the classpath for our FOP servlet?
> > 
> > 
> > If this is the case, I guess we can put them in the WAR file and then
> > redistribute it as needed. I was hoping for a cleaner solution.
> > 
> > Thanks,
> > Pete Allison
> >  
> 
> 
> 



Jeremias Maerki


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


Re: Location of external graphics

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Bundling the stylesheets in the WAR file is one solution that many users
seem to be using. Another could be using a XML Catalog (using XML
Commons Resolver from the Apache XML project). More information on the
resolver here:
http://xml.apache.org/commons/components/resolver/index.html
http://wiki.apache.org/xmlgraphics-fop/HowTo/XmlCommonsResolver

With an XML Catalog you could do things like rewriting URIs like:
myresources:xslt/mystylesheet.xslt
to:
file:/home/user/resources/xslt/mystylesheet.xslt

The XML Commons Resolver implements both the EntityResolver and
URIResolver interfaces. In FOP, you can configure your own URIResolver.
However, the Java example on the Wiki page above (as I had to notice now)
is hopelessly outdated. I'll see to it that it is updated.

Yet another way is to just set the base URI on the FopFactory to
something you define. But then you're still using relative filenames.
Not that this is bad in any way. But it can be hard to debug.

HTH

On 07.08.2008 19:16:18 Pete Allison wrote:
> This may not be the appropriate forum (may be more of a Java question), so I
> asked for your forbearance.
> 
> We are struggling with where to keep our image files. Right now we loading
> them with absolute file paths. This works for one application that "builds"
> the path based on environment information. This allows us to maintain
> portability. 
> 
> We have another application that does not know anything about its
> environment. When the application is moved from a development server to a
> production, we must update the stylesheet to reflect the server change. We
> would like to avoid this. 
> 
> It appears that file references, if not absolute, are relative to the (and
> here's the part we are a little fuzzy on) the classpath for our FOP servlet?
> 
> 
> If this is the case, I guess we can put them in the WAR file and then
> redistribute it as needed. I was hoping for a cleaner solution.
> 
> Thanks,
> Pete Allison
>  



Jeremias Maerki


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


RE: Location of external graphics

Posted by Pete Allison <ma...@aol.com>.
This may not be the appropriate forum (may be more of a Java question), so I
asked for your forbearance.

We are struggling with where to keep our image files. Right now we loading
them with absolute file paths. This works for one application that "builds"
the path based on environment information. This allows us to maintain
portability. 

We have another application that does not know anything about its
environment. When the application is moved from a development server to a
production, we must update the stylesheet to reflect the server change. We
would like to avoid this. 

It appears that file references, if not absolute, are relative to the (and
here's the part we are a little fuzzy on) the classpath for our FOP servlet?


If this is the case, I guess we can put them in the WAR file and then
redistribute it as needed. I was hoping for a cleaner solution.

Thanks,
Pete Allison
 


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