Hi, Thanks for your help. It works now.
Greetings, Andreas -----Ursprüngliche Nachricht----- Von: Manuel Mall [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 10. Januar 2006 11:14 An: fop-users@xmlgraphics.apache.org Betreff: Re: AW: problem with FOP 0.91.beta and gif images On Tue, 10 Jan 2006 06:11 pm, Andreas Grund wrote: > Hi Jeremias, > > First thanks for your help. But I think I forgot to say, that I call > FOP out of an java program using the FOPUserAgent. I set the baseURL > using the function FOPUserAgent.setBaseURL but it does not work. I > path a string like "file://c:/my/graphic/folder" to the function. I > tested a lot and get now the error message: ERROR FOP > - Error with opening URL '//bild1.gif': bild1.gif I changed the > path to the image to file://bild1.gif to get this error message. > I have not tested this but I believe a URL with out a host part must have 3 consecutive slashes not 2. Try "file:///c:/my/graphic/folder". Roughly(!) speaking the first two slashes separate the URL scheme from the host part and the 3rd slash separates the host part from the path. So "file:///c:/my/graphic/folder" is actually equivalent to "file://localhost/c:/my/graphic/folder". In your version "c:" (not sure if colon is a legal character here) would actually be the hostname. Manuel > Here is my code. Can you found the error in my code? > > FOUserAgent userAgent = new FOUserAgent(); > userAgent.setBaseURL("file://" + workingFolder.getAbsolutePath()); Fop > fop = new Fop(MimeConstants.MIME_PDF, userAgent); > > // configure fop > outputStream = new ByteArrayOutputStream(); > fop.setOutputStream(outputStream); > InputSource contentSource = new InputSource(content > .getInputStream()); > Source stylesheetSource = new StreamSource(styleSheetFile); > > SAXTransformerFactory transformerFactory = new > TransformerFactoryImpl(); TransformerHandler transformerHandler = > transformerFactory > .newTransformerHandler(stylesheetSource); > // Resulting SAX events (the generated FO) must be piped through to // > FOP Result res = new SAXResult(fop.getDefaultHandler()); > transformerHandler.setResult(res); > DcDefaultErrorHandler errorHandler = new DcDefaultErrorHandler( > report); > transformerHandler.getTransformer().setErrorListener(errorHandler); > reader.setContentHandler(transformerHandler); > reader.setErrorHandler(errorHandler); > reader.parse(contentSource); > return new DcByteArrayContentAttributeValue(null, outputStream, > contentTypeName, resultFileName); > > Thanks for your help. > > Greetings, > Andreas > > -----Ursprüngliche Nachricht----- > Von: Jeremias Maerki [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 10. Januar 2006 10:02 > An: fop-users@xmlgraphics.apache.org > Betreff: Re: problem with FOP 0.91.beta and gif images > > The command-line of FOP uses the directory of the source XML file (not > the stylesheet) as base directory/URL. If your stylesheet is not in > the same directory as the XML file FOP won't find it if you don't > specify an explicit base directory in the config file. So, the > work-around for you at the moment is to explicitely set the base URL > in the config file (Element: "base"). > > If I'm thinking about it, it is probably a bad idea to use the XML > file as base URL source when a stylesheet is used. Normally, you'd > place the resources for a stylesheet relative to the stylesheet, not > the source XML file. fop-devs, what do you think? It would be easy to > fix. On the other side, 0.20.5 seems to do the same (see > Options.setCommandLineOptions). > > On 10.01.2006 09:38:03 Andreas Grund wrote: > > Hi, > > > > i create a stylesheet containing the following source: > > > > <fo:table-cell column-number="1"> > > <fo:block><fo:external-graphic src="bild1.gif" > > content-width="75mm"/></fo:block> </fo:table-cell> > > > > Everytime i try to publish my xml-file using my stylesheet i got the > > error message: image not available: bild1.gif. But the image file is > > stored in the same folder as the stylesheet. Why does Fop not found > > the image? I use fop 0.91.beta with all jars found in the > > downloadfile: fop-0.91beta-bin-jdk1.4.zip. Do I need some further > > jars to enable gif support in FOP? > > Jeremias Maerki > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]