Loading ...
Sorry, an error occurred while loading the content.
 

Problem loading images in PDF with FOP

Expand Messages
  • John Walker
    Hi all! I m trying to transform an XSL-FO file to PDF in a servlet with FOP embedded. I m using FOP 0.20.4, JDK 1.4.0 and Tomcat 4.0.2. Everything works, but
    Message 1 of 4 , May 6 12:59 AM
      Hi all! I'm trying to transform an XSL-FO file to PDF in a servlet with
      FOP embedded. I'm using FOP 0.20.4, JDK 1.4.0 and Tomcat 4.0.2.
      Everything works, but when there's an image in the XSL-FO like this:

      <fo:external-graphic height="2cm" width="4.8cm"
      src="/usr/local/web-datos/tomcat/images/ger.jpg"/>

      the next exception occurs:

      javax.servlet.ServletException: org/w3c/dom/svg/SVGDocument
      at
      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:463)
      at
      org.apache.jsp.muestraDocumentos$jsp._jspService(muestraDocumentos$jsp.java:104)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
      ....
      ....
      java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGDocument
      at org.apache.fop.image.analyser.ImageReaderFactory.Make(Unknown Source)
      at org.apache.fop.image.FopImageFactory.Make(Unknown Source)
      at org.apache.fop.fo.flow.ExternalGraphic.layout(Unknown Source)
      ....
      ....

      But I'm not using SVG but just a simple JPG image! Any idea? I need some
      help... Thanks!!
    • Chris Bowditch
      ... I admit it is strange that FOP is looking for a SVG class when your image is Jpg. Make sure you have Batik.jar in your classpath. It comes with the FOP
      Message 2 of 4 , May 6 1:06 AM
        >From: John Walker <dtd2050@...>
        >
        >
        ><fo:external-graphic height="2cm" width="4.8cm"
        >src="/usr/local/web-datos/tomcat/images/ger.jpg"/>
        >
        >the next exception occurs:
        >
        >javax.servlet.ServletException: org/w3c/dom/svg/SVGDocument
        > at
        >org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:463)
        > at
        > ....
        > ....
        >java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGDocument
        > at org.apache.fop.image.analyser.ImageReaderFactory.Make(Unknown
        >Source)

        I admit it is strange that FOP is looking for a SVG class when your image is
        Jpg. Make sure you have Batik.jar in your classpath. It comes with the FOP
        distribution and its no effort to include it in your classpath even if you
        dont need it!

        You will get better responses to FOP specific questions on the FOP user
        list;

        http://xml.apache.org/fop/resources.html#mailing-lists-fop-user

        Chris

        _________________________________________________________________
        Surf together with new Shared Browsing
        http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=1059
      • John Walker
        Hi Chris! Yes, I have batik.jar in the classpath but still doesn t work. Thank you for the reference to FOP user list. I ll send there my question. ...
        Message 3 of 4 , May 6 1:45 AM
          Hi Chris! Yes, I have batik.jar in the classpath but still doesn't work.
          Thank you for the reference to FOP user list. I'll send there my question.

          Chris Bowditch escribió:

          >>From: John Walker <dtd2050@...>
          >>
          >>
          >><fo:external-graphic height="2cm" width="4.8cm"
          >>src="/usr/local/web-datos/tomcat/images/ger.jpg"/>
          >>
          >>the next exception occurs:
          >>
          >>javax.servlet.ServletException: org/w3c/dom/svg/SVGDocument
          >> at
          >>org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:463)
          >> at
          >> ....
          >> ....
          >>java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGDocument
          >> at org.apache.fop.image.analyser.ImageReaderFactory.Make(Unknown
          >>Source)
          >>
          >>
          >
          >I admit it is strange that FOP is looking for a SVG class when your image is
          >Jpg. Make sure you have Batik.jar in your classpath. It comes with the FOP
          >distribution and its no effort to include it in your classpath even if you
          >dont need it!
          >
          >You will get better responses to FOP specific questions on the FOP user
          >list;
          >
          >http://xml.apache.org/fop/resources.html#mailing-lists-fop-user
          >
          >Chris
          >
          >_________________________________________________________________
          >Surf together with new Shared Browsing
          >http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=1059
          >
          >
          >
          >To unsubscribe from this group, send an email to:
          >XSL-FO-unsubscribe@egroups.com
          >
          >
          >
          >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
          >
          >
          >
          >



          [Non-text portions of this message have been removed]
        • abhisheksanwal
          I was informed by some guys at Chive.com (Apoc) that a URL starting with / was inappropriate. This is a quote of the email from him about FO and URLs in FO for
          Message 4 of 4 , Jun 4, 2003
            I was informed by some guys at Chive.com (Apoc) that a URL starting
            with / was inappropriate. This is a quote of the email from him about
            FO and URLs in FO for embedding images into a resulting PDF.

            Quote:
            To get the sample working correctly I made the following changes to
            the FO:

            Changed the external-graphic src attribute from "url
            (/smallsample.images/pict0.jpg)" to url(smallsample.images/pict0.jpg)

            Any observations? Suggestions ?

            --- In XSL-FO@yahoogroups.com, John Walker <dtd2050@y...> wrote:
            > Hi all! I'm trying to transform an XSL-FO file to PDF in a servlet
            with
            > FOP embedded. I'm using FOP 0.20.4, JDK 1.4.0 and Tomcat 4.0.2.
            > Everything works, but when there's an image in the XSL-FO like this:
            >
            > <fo:external-graphic height="2cm" width="4.8cm"
            > src="/usr/local/web-datos/tomcat/images/ger.jpg"/>
            >
            > the next exception occurs:
            >
            > javax.servlet.ServletException: org/w3c/dom/svg/SVGDocument
            > at
            > org.apache.jasper.runtime.PageContextImpl.handlePageException
            (PageContextImpl.java:463)
            > at
            > org.apache.jsp.muestraDocumentos$jsp._jspService
            (muestraDocumentos$jsp.java:104)
            > at org.apache.jasper.runtime.HttpJspBase.service
            (HttpJspBase.java:107)
            > ....
            > ....
            > java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGDocument
            > at org.apache.fop.image.analyser.ImageReaderFactory.Make
            (Unknown Source)
            > at org.apache.fop.image.FopImageFactory.Make(Unknown Source)
            > at org.apache.fop.fo.flow.ExternalGraphic.layout(Unknown Source)
            > ....
            > ....
            >
            > But I'm not using SVG but just a simple JPG image! Any idea? I need
            some
            > help... Thanks!!
          Your message has been successfully submitted and would be delivered to recipients shortly.