problem with FOP 0.91.beta and gif images

2006-01-10 Thread Andreas Grund



Hi,

i create a 
stylesheet containing the following source:

fo:table-cell 
column-number="1"fo:blockfo:external-graphic 
src="" 
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?

Best regards - med venlig hilsen 
– mit freundlichen Grüssen

Andreas Grund

__

  
  

  Andreas 
  Grund Dipl. 
  Wi-Inf. (BA)

  

  KGU-Consulting 
  GmbH
  

  Software-Developer

  

  Lise-Meitner-Str. 
  2
  

  phone:

  +49 
  461 31852-18

  D 
  24941 Flensburg
  

  telefax:

  +49 
  461 
  31852-20

  web: 
  http://www.kgu-consulting.de 
  



Re: problem with FOP 0.91.beta and gif images

2006-01-10 Thread Jeremias Maerki
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:blockfo: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]



Re: problem with FOP 0.91.beta and gif images

2006-01-10 Thread Kaarle Kaila



hej,

I have used something like this 

fo:external-graphic src="url(pave_files/P1R7.jpg)"/

And it works 
OK!
med vänlig 
hälsning
Kaarle 
Kaila

  - Original Message - 
  From: 
  Andreas Grund 
  To: fop-users@xmlgraphics.apache.org 
  
  Sent: Tuesday, January 10, 2006 10:38 
  AM
  Subject: problem with FOP 0.91.beta and 
  gif images
  
  Hi,
  
  i create a 
  stylesheet containing the following source:
  
  fo:table-cell 
  column-number="1"fo:blockfo:external-graphic 
  src="" 
  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?
  
  Best regards - med venlig 
  hilsen – mit freundlichen Grüssen
  
  Andreas 
Grund
  
  __
  


  
Andreas 
Grund Dipl. 
Wi-Inf. (BA)
  

  
KGU-Consulting 
GmbH

  
Software-Developer
  

  
Lise-Meitner-Str. 
2

  
phone:
  
+49 
461 31852-18
  
D 
24941 Flensburg

  
telefax:
  
+49 
461 
31852-20
  
web: 
http://www.kgu-consulting.de 

  


Re: problem with FOP 0.91.beta and gif images

2006-01-10 Thread Kaarle Kaila
hi,

In my current case the images would belong to the XML file and not the
stylesheet so current is OK with me!
For some other case I could need some icons etc from a common directory.

regards
Kaarle Kaila


- Original Message - 
From: Jeremias Maerki [EMAIL PROTECTED]
To: fop-users@xmlgraphics.apache.org
Sent: Tuesday, January 10, 2006 11:01 AM
Subject: 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:blockfo: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]



Re: AW: problem with FOP 0.91.beta and gif images

2006-01-10 Thread Manuel Mall
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:blockfo: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]



RE: AW: problem with FOP 0.91.beta and gif images

2006-01-10 Thread Jukka Ignatius
 -Original Message-
 From: Manuel Mall [mailto:[EMAIL PROTECTED] 
 
 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.

I have neither tested this with FOP, but just to confirm this really is
following the rfc 3986: If a URI contains an authority component, then
the path component must either be empty or begin with a slash (/)
character..

-Jukka

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: problem with FOP 0.91.beta and gif images

2006-01-10 Thread Glen Mazza

Jeremias Maerki wrote:


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



Hmmm...that's a good point, it depends on the scenario.  If the graphics 
are common for all generations using that stylesheet (say, a graphical 
masthead of a newsletter), your suggestion makes the most amount of sense.


But imagine a stylesheet used to print a one page biography for an 
arbitrary person, and that the stylesheet displays a photo.gif picture 
of the person in a certain area.  I could imagine each person for which 
we would want to use the stylesheet having his own directory with a 
bio.xml and photo.gif. Then, the stylesheet would use the specific 
photo.gif in the directory where the specified bio.xml file is.


Perhaps an option allowing for either scenario would be best.

Glen


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: problem with FOP 0.91.beta and gif images

2006-01-10 Thread J.Pietschmann

Jeremias Maerki wrote:

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.


The XML source may refer to other ressources as well, which would
probably use the XML source URL as base.
That's not going to be easy to resolve, because after the transformation
there's no way to know whether a reference came from the XML source or
from the style sheet.
I'd keep the XML source URL as a base, and tell people to set a base URL
in the config if image URLs are to be resolved against the style sheet's
URL. For more advanced use cases, we probably  need a search path, or
the user has to supply a custom URI resolver.

J.Pietschmann

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]