Rendering GIF images to PDF?

2003-05-12 Thread Ozhan Hassan
Hi,

I have been evaluating FOP for the past couple of weeks. Basically, I have
a java wrapper program which calls the FOP libraries, which reads in an
XSLT style sheet and an XML file with data, then produces PDF for each XML
file read in. I have set my program to read in 1000 XML files and produce
1000 PDFs. The sole purpose of this is to get some performance timings on
different operating systems/machines. 

One of the tests I ran consisted of producing PDFs which where 4 pages
long, that contained a large table, somet text formatting, some SVG and
two GIF images. Comparing this test on the Windows 2000 environment to the
Windows XP environment came as a shock. The test on Windows 2000 completed
in around 7 minutes, whereas on Windows XP it was closer to 20 minutes. 

The Windows 2000 machine has a P4 1.8Ghz CPU, 256mb RAM. The Windows XP
machine much more powerful, a P4 3 Ghz, 1Gb RAM. This is why these results
were disturbing.

Does anyone know why GIFs take so long to render under Windows XP? My
guess is, as GIF is patented, Windows 2000 seems to easily convert the GIF
into another format prior to rendering (maybe using a windows tool).
However, in XP, this tool may no longer be present, hence the process
maybe follows another path which seems to be more expensive? I don't know,
this is just a guess. Also note that under XP, the CPU usage while running
this hovers around the 20% mark.

I tried converting the GIFs to JPGs and the test completed in 4 minutes
under XP (CPU usage was close to 100%), so I am certain the problem lies
with GIFs alone. Could anyone please help me out here with some insight?

Regards,
Ozhan



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



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]



test

2003-05-02 Thread Ozhan Hassan



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



Class Transformer not found

2003-05-02 Thread Ozhan Hassan
Hi,

Hi hope I am sending this to the correct user mailing list. 

I am trying to write a simple application to read in an xml file and and
xslt style sheet, then produce a PDF. Below is a snippet of the main code
which does this:

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 transformer = TransformerFactory.newInstance()
.newTransformer(new StreamSource(INPUT_DIR + INPUT_XSLT));
transformer.transform(new InputSource(INPUT_DIR + INPUT_XML),
new SAXResult(driver.getContentHandler()));

However, I am getting the following error:

 [javac]
/home/server/test/RendingEngines/FOP/source/fop-0.20.4/build/src/RenderingEngineXslt.java:60:
Class Transformer not found.
[javac] Transformer transformer = TransformerFactory.newInstance()
[javac] ^
[javac] 
/home/server/test/RendingEngines/FOP/source/fop-0.20.4/build/src/RenderingEngineXslt.java:61:
Class StreamSource not found.
[javac].newTransformer(new StreamSource(INPUT_DIR + 
INPUT_XSLT));
[javac]^
[javac] 2 errors, 1 warning

I have the xalan_2.3.1.jar file in my class path. I also import the
following, where the 2nd import isn't found:

import javax.xml.transform.TransformerFactory; 
import org.apache.xalan.xsltc.trax.TransformerFactoryImpl; 

Can anyone help me out?

Regards,
Ozhan


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



Re: Class Transformer not found

2003-05-02 Thread Ozhan Hassan
On Fri, 2 May 2003, Jeremias Maerki wrote:

 Class Transformer not found simply means that JAXP is not in your
 classpath during compilation. You need to make sure that xml-apis.jar 
 (which contains JAXP) is also in your classpath.

I already have xml-apis.jar in my classpath. Basically, I include all the
jar files from the /lib directory in my class path. Which libraries do I
need to import to use the Transformer object? Is there anything else which 
I am missing?

Kind Regards,
Ozhan

 
 On 02.05.2003 05:34:30 Ozhan Hassan wrote:
  Hi hope I am sending this to the correct user mailing list. 
 
 You are.
 
  I am trying to write a simple application to read in an xml file and and
  xslt style sheet, then produce a PDF. Below is a snippet of the main code
  which does this:
  
  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 transformer = TransformerFactory.newInstance()
  .newTransformer(new StreamSource(INPUT_DIR + INPUT_XSLT));
  transformer.transform(new InputSource(INPUT_DIR + INPUT_XML),
  new SAXResult(driver.getContentHandler()));
  
  However, I am getting the following error:
  
   [javac]
  /home/server/test/RendingEngines/FOP/source/fop-0.20.4/build/src/RenderingEngineXslt.java:60:
  Class Transformer not found.
  [javac] Transformer transformer = TransformerFactory.newInstance()
  [javac] ^
  [javac] 
  /home/server/test/RendingEngines/FOP/source/fop-0.20.4/build/src/RenderingEngineXslt.java:61:
  Class StreamSource not found.
  [javac].newTransformer(new StreamSource(INPUT_DIR + 
  INPUT_XSLT));
  [javac]^
  [javac] 2 errors, 1 warning
  
  I have the xalan_2.3.1.jar file in my class path. I also import the
  following, where the 2nd import isn't found:
  
  import javax.xml.transform.TransformerFactory; 
  import org.apache.xalan.xsltc.trax.TransformerFactoryImpl; 
  
  Can anyone help me out?
 
 
 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]