xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Kevin.W...@alltel.com>
Subject FW: Using FOP / trying to embed FOP
Date Fri, 03 Jan 2003 14:05:00 GMT

> Trying to embed FOP within Java.  I added code that the documentation stated was necessary
in order to embed FOP.  I compiled the code.  I get errors when instantiating the FOP Driver
class.  I apologize for this be lengthy.  
> 
> 
> -----------Executing my java code:------------------------------------  
> 
> My goal is to take one of the sample .fo files (simple.fo) and generate a pdf file.
> 
> 
> **************
> Error:********
> **************
> 
> 
> ----------------------------------------------------
> ----------------------------------------------------
> C:\fop-0.20.5rc>java embed simple.fo testembed.pdf
> argument1:  simple.fo
> argument2:  testembed.pdf
> 
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/fop/fo/PropertyList
> 
>         at org.apache.fop.apps.Driver.<init>(Driver.java:178)
>         at org.apache.fop.apps.Driver.<init>(Driver.java:186)
>         at embed.main(embed.java:60)
> 
> C:\fop-0.20.5rc>
> -----------------------------------------------------
> -----------------------------------------------------
> 
> 
> I can see a PropertyList.java file but no class file.
> 
> Compiling PropertyList.java gives the following error
> 
> ------------------------------------------------------
> ------------------------------------------------------
> C:\org\apache\fop\fo>javac PropertyList.java
> PropertyList.java:11: Class org.apache.fop.fo.properties.WritingMode not found in import.
> import org.apache.fop.fo.properties.WritingMode;
>        ^
> 1 error
> 
> C:\org\apache\fop\fo>
> ------------------------------------------------------
> ------------------------------------------------------
> 
> 
> There is only one file (package.html) in the org.apache.fop.fo.properties.
> 
> This file states the following:
> 
> "> Classes representing XSL-FO properties (See ยง7 of the XSL 1.0 Standard).> ">

> 
> 
> 
> 
> ************* Questions ****************************************
> ****************************************************************
> 
> Problem locating these files...Where do I get them?  
> Are there any steps that I need to do in order to get this to work?  
> What is the purpose for building FOP?
> Is there anything wrong with my code located below?
> 
> 
> 
> 
> 
> *********************************************************
> My Java code:  ******************************************
> *********************************************************
> 
> 
> I had to add a lot of import statements to get the code to compile.
> 
> 
> import java.util.*;
> import java.text.*;
> import org.apache.fop.apps.Driver;
> import org.xml.sax.InputSource;
> import org.apache.avalon.framework.logger.ConsoleLogger;
> import org.apache.avalon.framework.logger.Logger;
> 
> 
> // FOP
> import org.apache.fop.fo.*;
> import org.apache.fop.configuration.Configuration;
> import org.apache.fop.configuration.ConfigurationReader;
> import org.apache.fop.fo.ElementMapping;
> import org.apache.fop.fo.FOTreeBuilder;
> import org.apache.fop.render.Renderer;
> //import org.apache.fop.render.pdf.PDFRenderer;
> import org.apache.fop.tools.DocumentInputSource;
> import org.apache.fop.tools.DocumentReader;
> import org.apache.fop.messaging.MessageHandler;
> 
> // Avalon
> import org.apache.avalon.framework.logger.ConsoleLogger;
> import org.apache.avalon.framework.logger.Logger;
> 
> // DOM
> import org.w3c.dom.Document;
> 
> // SAX
> import org.xml.sax.ContentHandler;
> import org.xml.sax.InputSource;
> import org.xml.sax.SAXException;
> import org.xml.sax.XMLReader;
> 
> 
> // Java
> import java.io.BufferedReader;
> import java.io.InputStreamReader;
> import java.io.InputStream;
> import java.io.IOException;
> import java.io.OutputStream;
> import java.util.Enumeration;
> import java.util.HashMap;
> import java.util.Vector;
> 
> //import java.io.OutputStream;
> import java.io.*;
> 
> 
> //import org.apache.avalon.ramwork.logger.Logger;
> 
> public class embed
> {
> 	public static void main(String[] args)> 
> 	{
> 
> 		try{
> 	    System.out.println("argument1:  " + args[0]);
> 	    System.out.println("argument2:  " + args[1]);
> 
> 		Driver driver = new Driver (new InputSource (args[0]),
> 		                            new FileOutputStream(args[1]));
> 		driver.setRenderer(Driver.RENDER_PDF);
> 
> 
> 		driver.run();
> 
> 		Logger logger = new ConsoleLogger (ConsoleLogger.LEVEL_INFO);
> 		MessageHandler.setScreenLogger(logger);
> 		driver.setLogger(logger);
> 
> 		//userConfigFile = new File(userConfig);
> 		//options = new Options(userConfigFile);
> 		}catch(Exception e)
> 	    {
> 		}
> 
> 
> 
> 
> 
> 		//System.out.println("");
> 		//System.out.println("");
> 
> 
> 
> 	}
> 
> }
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Mime
View raw message