Problem rendering SVG graphic

2003-06-19 Thread Howard Miller
Hi,
I am new to fop (and SVG) so I hope this isn't a stupid question...
I am trying to embed an external SVG graphic file into a fop document.  
I am simply using
fo:external-graphic src=url(image.svg) 

when I run fop it falls over with a Java excecution trace. The first  
few lines look like...

can somebody point me in the right direction here (I checked and batik  
is in the fop lib directory! )

Thanks!
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] FOP 0.20.5rc3a
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] [1]
[INFO] [1]
Exception in thread main java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:130)
at  
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnviron 
ment.java:62)
at  
java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1053)
at  
org.apache.fop.svg.PDFGraphics2D.init(PDFGraphics2D.java:1401)
at  
org.apache.fop.render.pdf.PDFRenderer.renderSVGDocument(PDFRenderer.java 
:638)
at  
org.apache.fop.render.pdf.PDFRenderer.drawImageScaled(PDFRenderer.java:3 
80)
at  
org.apache.fop.render.AbstractRenderer.renderImageArea(AbstractRenderer. 
java:326)
at org.apache.fop.image.ImageArea.render(ImageArea.java:107)
at  
org.apache.fop.render.AbstractRenderer.renderLineArea(AbstractRenderer.j 
ava:516)
at org.apache.fop.layout.LineArea.render(LineArea.java:519)
at  
org.apache.fop.render.AbstractRenderer.renderBlockArea(AbstractRenderer. 
java:485)
at org.apache.fop.layout.BlockArea.render(BlockArea.java:117)

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


Re: Problem rendering SVG graphic

2003-06-19 Thread J.Pietschmann
Howard Miller wrote:
Exception in thread main java.lang.NoClassDefFoundError
...
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnviron 
ment.java:62)
Looks like you got a headless server. See
 http://xml.apache.org/fop/faq.html#svg-headless
J.Pietschmann

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


Re: Problem rendering SVG

2003-05-07 Thread Ozhan Hassan
On Mon, 5 May 2003, Jeremias Maerki wrote:

 Try setting the log level to LEVEL_DEBUG and watch the log. Maybe that
 helps finding out what's wrong. Without actually running your code, I'd
 say it should be ok.
 
 What you can also try is to disable the stylesheet (by using the
 identity transformer and loading an XSL:FO file). This helps narrow down
 the possibilities for errors. Also temporarily comment out the SVG code
 in your stylesheet to see if it has something to do with that.

I know that there is nothing wrong with the XSLT, including the SVG
because if I run fop from the command line, passing it an XML file and the
XSLT, it works fine. It only hangs when I run it via my application. I am
guessing that maybe my application isn't setting a property which is
needed, or something like that. If I comment out the SVG, my application
runs fine. Does anyone know why this is happening?

Regards.
Ozhan

 
 On 05.05.2003 09:23:50 Ozhan Hassan wrote:
  I am experiencing some a weird problem while trying to render some SVG.
  I have a simple java program which reads in an XML file and an XSLT
  stylesheet (containing some SVG) and render it out to PDF. What happens is
  my terminal just frezzes, and I can't kill the process or do anything
  else. The process only hangs when I run my application, i.e. if I run fop
  from the command line passing it the XSLT with the SVG, it works fine.
 
 snip what=code/
 
 
 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: Problem rendering SVG

2003-05-07 Thread Jeremias Maerki
You didn't say whether setting the log level to LEVEL_DEBUG helped or
not. Even if your XSLT is ok, my suggestions still apply. I've found
bugs that way before. So if it's really the SVG that's having a problem
check if Batik is in the classpath and if you're using the version
that's coming with your FOP version.

On 07.05.2003 02:29:54 Ozhan Hassan wrote:
 I know that there is nothing wrong with the XSLT, including the SVG
 because if I run fop from the command line, passing it an XML file and the
 XSLT, it works fine. It only hangs when I run it via my application. I am
 guessing that maybe my application isn't setting a property which is
 needed, or something like that. If I comment out the SVG, my application
 runs fine. Does anyone know why this is happening?



Jeremias Maerki


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



Re: Problem rendering SVG

2003-05-07 Thread Ozhan Hassan
On Wed, 7 May 2003, Jeremias Maerki wrote:

 You didn't say whether setting the log level to LEVEL_DEBUG helped or
 not. Even if your XSLT is ok, my suggestions still apply. I've found
 bugs that way before. So if it's really the SVG that's having a problem
 check if Batik is in the classpath and if you're using the version
 that's coming with your FOP version.

Hi,

Sorry, I forgot to mention that. I did try it with the log level set to
LEVEL_DEBUG, but it made no difference. I didn't receive any additional
output from using the standard LEVEL_INFO. I also have batik.jar in my
classpath. Any other ideas?

Regards,
Ozhan

 
 On 07.05.2003 02:29:54 Ozhan Hassan wrote:
  I know that there is nothing wrong with the XSLT, including the SVG
  because if I run fop from the command line, passing it an XML file and the
  XSLT, it works fine. It only hangs when I run it via my application. I am
  guessing that maybe my application isn't setting a property which is
  needed, or something like that. If I comment out the SVG, my application
  runs fine. Does anyone know why this is happening?
 
 
 
 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: Problem rendering SVG

2003-05-07 Thread Ozhan Hassan
Hi,

One more interesting point I should address. I have been running my
application on a Solaris platform, where it has been crashing. However, I
just tried running it on a Windows PC and it worked fine, didn't crash. I
hope this is helpful to anyone who may know why this is.

Regards,
Ozhan


Ozhan Hassan
Multimedia Database Systems
RMIT University
Email: [EMAIL PROTECTED]
Phone: 9925 4118

On Wed, 7 May 2003, Ozhan Hassan wrote:

 On Wed, 7 May 2003, Jeremias Maerki wrote:
 
  You didn't say whether setting the log level to LEVEL_DEBUG helped or
  not. Even if your XSLT is ok, my suggestions still apply. I've found
  bugs that way before. So if it's really the SVG that's having a problem
  check if Batik is in the classpath and if you're using the version
  that's coming with your FOP version.
 
 Hi,
 
 Sorry, I forgot to mention that. I did try it with the log level set to
 LEVEL_DEBUG, but it made no difference. I didn't receive any additional
 output from using the standard LEVEL_INFO. I also have batik.jar in my
 classpath. Any other ideas?
 
 Regards,
 Ozhan
 
  
  On 07.05.2003 02:29:54 Ozhan Hassan wrote:
   I know that there is nothing wrong with the XSLT, including the SVG
   because if I run fop from the command line, passing it an XML file and the
   XSLT, it works fine. It only hangs when I run it via my application. I am
   guessing that maybe my application isn't setting a property which is
   needed, or something like that. If I comment out the SVG, my application
   runs fine. Does anyone know why this is happening?
  
  
  
  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: Problem rendering SVG

2003-05-07 Thread Jeremias Maerki
Ok, in this case take the examples/embedding/java/embedding/ExampleXML2PDF.java
and adjust it to your usecase. Check if it works with that. I've tested
it with your XSL snippet on my workstation and it worked.

On 07.05.2003 08:22:58 Ozhan Hassan wrote:
 Sorry, I forgot to mention that. I did try it with the log level set to
 LEVEL_DEBUG, but it made no difference. I didn't receive any additional
 output from using the standard LEVEL_INFO. I also have batik.jar in my
 classpath. Any other ideas?


Jeremias Maerki


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



Re: Problem rendering SVG

2003-05-07 Thread Jeremias Maerki
Is that a headless server? In this case 
http://xml.apache.org/fop/faq.html#svg-headless
may help.

On 07.05.2003 08:45:32 Ozhan Hassan wrote:
 One more interesting point I should address. I have been running my
 application on a Solaris platform, where it has been crashing. However, I
 just tried running it on a Windows PC and it worked fine, didn't crash. I
 hope this is helpful to anyone who may know why this is.


Jeremias Maerki


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



Problem rendering SVG

2003-05-05 Thread Ozhan Hassan
Hi,

I am experiencing some a weird problem while trying to render some SVG.
I have a simple java program which reads in an XML file and an XSLT
stylesheet (containing some SVG) and render it out to PDF. What happens is
my terminal just frezzes, and I can't kill the process or do anything
else. The process only hangs when I run my application, i.e. if I run fop
from the command line passing it the XSLT with the SVG, it works fine.

Here is SVG from the XSLT style sheet:

xsl:template name=DisplaySvg
fo:instream-foreign-object
svg:svg xmlns:svg=http://www.w3.org/2000/svg; 
width = 300 height=200 viewBox=0 0 300 200 
xml:space=preserve
  svg:g style=fill:white; stroke:#00
 svg:line x1=0 y1=200 x2=0 y2=0/
 svg:line x1=0 y1=200 x2=200 y2=200/
 svg:rect x=10 y=150 width=20 height=50 
style=fill:blue; stroke:#00/
 svg:rect x=40 y=170 width=20 height=30 
style=fill:black; stroke:#00/
 svg:rect x=70 y=100 width=20 height=100 
style=fill:green; stroke:#00/
 svg:rect x=100 y=20 width=20 height=180 
style=fill:yellow; stroke:#00/
 svg:rect x=130 y=150 width=20 height=50 
style=fill:red; stroke:#00/
  /svg:g
/svg:svg
/fo:instream-foreign-object
/xsl:template 

---

The my java application which does what I explained above is:

import java.io.*;

// FOP libraries
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Version;
import org.apache.fop.messaging.MessageHandler;

import org.xml.sax.InputSource;
import org.apache.fop.apps.FOPException;

import org.apache.avalon.framework.logger.ConsoleLogger;  
import org.apache.avalon.framework.logger.Logger; 

import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import javax.xml.transform.sax.*;


class RenderingEngineXsltSvg
{

// number of PDFs to be generated
static final int OUTPUT_SIZE = 1;
static final String INPUT_XML = statement.xml;
static final String INPUT_XSLT = toXslFoSVG.xslt;
static final String INPUT_DIR = ../../tmp/input/;
static final String OUTPUT_DIR = ../../tmp/output/;


public static void main(String args[])
{
try
{
// only create the Transformer which reads the XSLT once
Transformer transformer = TransformerFactory.newInstance()
.newTransformer(new StreamSource(INPUT_DIR + INPUT_XSLT));

for(int i = 1; i = OUTPUT_SIZE; i++)
{
String fileName = INPUT_XML;
int fileLength = fileName.length();

fileName = fileName.substring(0, fileLength - 4);
String outFileName = OUTPUT_DIR + fileName + i + .pdf;

Driver driver = new Driver();
driver.setOutputStream(new
FileOutputStream(outFileName));
Logger logger = new
ConsoleLogger(ConsoleLogger.LEVEL_INFO);
MessageHandler.setScreenLogger(logger);
driver.setLogger(logger);
driver.setRenderer(Driver.RENDER_PDF);

transformer.transform(new 
StreamSource(INPUT_DIR + INPUT_XML),
new SAXResult(driver.getContentHandler()));

System.out.println(* GENERATED PDF:  + i + 
*);
}
}
catch (javax.xml.transform.TransformerConfigurationException ex)
{
System.err.println(Exception:  + ex.toString());
}
catch (javax.xml.transform.TransformerException ex)
{
System.err.println(Exception:  + ex.toString());
}
catch (IOException ex)
{
System.err.println(IO Exception:  + ex.toString());
}

// Everything is OK - exit
System.exit(0);
}
}

---

Any help would be appreciated.

Regards,
Ozhan


Ozhan Hassan
Multimedia Database Systems
RMIT University
Email: [EMAIL PROTECTED]
Phone: 9925 4118


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