Re: [afp-renderer-users] can't get it working :-(
Brought to you by:
towny,
tumbarumba
From: Pete T. <pe...@to...> - 2004-10-13 07:48:23
|
Michael, Please see the JUnit test case below for a example: package org.apache.fop.renderer.afp; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import org.apache.avalon.framework.logger.ConsoleLogger; import org.apache.avalon.framework.logger.Logger; import org.apache.fop.apps.Driver; import org.apache.fop.messaging.MessageHandler; import org.apache.fop.render.afp.AFPRenderer; import org.apache.fop.render.afp.extensions.AFPElementMapping; import org.xml.sax.InputSource; import junit.framework.TestCase; public class AFPRendererTest extends TestCase { private Driver _driver; protected void setUp() throws Exception { super.setUp(); // Construct driver _driver = new Driver(); _driver.addElementMapping(new AFPElementMapping()); // Setup logger Logger logger = new ConsoleLogger(); _driver.setLogger(logger); MessageHandler.setScreenLogger(logger); // Setup Renderer (output format) AFPRenderer renderer = new AFPRenderer(); renderer.setLogger(logger.getChildLogger("afprenderer")); _driver.setRenderer(renderer); } public void testReadmeFO() throws Exception { // Setup output BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream("test/test-output/readme.afp"), 12000); try { _driver.setOutputStream(out); // Setup input BufferedInputStream in = new BufferedInputStream( new FileInputStream("test/test-input/readme.fo"), 12000); try { _driver.setInputSource(new InputSource(in)); //Process FO _driver.run(); } finally { in.close(); } } finally { out.close(); } } } ----- Original Message ----- From: "Joe Schmetzer" <jo...@ex...> To: <afp...@li...>; "Michael Knigge" <kn...@gm...> Cc: <to...@us...> Sent: Tuesday, October 12, 2004 5:17 PM Subject: Re: [afp-renderer-users] can't get it working :-( > Hi Michael, > > Unfortunately the docs on the website aren't quite complete at this > point. The main issue not addressed right now is processing the input > files (see > http://afp-renderer.sourceforge.net/getting-started.html#Process_Input_Files). That one sentence doesn't really explain in enough detail what is required. The fop command line doesn't yet know how to handle the -afp output format, which means that you will (currently) have to write some java code to bootstrap the output renderer. > > Unfortunately, I don't have the appropriate example code handy this > second, but Pete (the main developer) should be able to provide it > fairly soon. I'll make sure website is updated with something more > useful. > > The fop embedding page at http://xml.apache.org/fop/embedding.html gives > the general idea of what is needed, except that the afp renderer should > be specified as the driver. > > As you've found out, this project has just started and so the > documentation isn't quite there yet (but we're working on it). > > Cheers, > Joe > > On Tue, 2004-10-12 at 08:13, Michael Knigge wrote: > > All, > > > > I can't gat this AFP-renderer working and I hope that someone here can help > > me. > > > > What I did: > > > > At fist I've installed J2SE (Runtime only on WinXP Pro). Then I've > > downloaded FOP (0.20.5) and the AFP-renderer. > > > > I put the afp-renderer-bin-1.0.1.jar file to %LOCAL_FOP_HOME%lib and added > > this file to my %LOCALCLASSPATH%. > > > > I also stored the afp-fonts.dtd and afp-fonts.xml file in the same directory > > where I put the afp-renderer-bin-1.0.1.jar file. > > > > Then I've created a directory named afp-font-resources in the same directory > > and put my resources there (for testing purposes, I put there some afp-fonts > > and renamed them so the match the names in your sample afp-fonts.* files). > > > > For my understanding, I did everything mentioned on the web-site. > > > > Then, I've tried to run FOP: > > > > java -cp "%LOCALCLASSPATH%" org.apache.fop.apps.Fop -d -xml test.xml -xsl > > test.xslt -afp test.afp > > > > > > But... test.afp is not created. What did I wrong? > > > > Hope someone can help me.... > > > > Thanks, > > Michael > > > > > > Here is the .BAT I've used: > > > > @ECHO OFF > > > > rem %~dp0 is the expanded pathname of the current script under NT > > set LOCAL_FOP_HOME= > > if "%OS%"=="Windows_NT" set LOCAL_FOP_HOME=%~dp0 > > > > set LIBDIR=%LOCAL_FOP_HOME%lib > > set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar > > set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis.jar > > set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.2.1.jar > > set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.4.1.jar > > set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik.jar > > set > > LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-cvs-20020806.jar > > set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar > > set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar > > set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_codec.jar > > set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\afp-renderer-bin-1.0.1.jar > > > > java -cp "%LOCALCLASSPATH%" org.apache.fop.apps.Fop -d -xml test.xml -xsl > > test.xslt -afp test.afp > > > > > > And here is the output from FOP: > > > > [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser > > [INFO] base directory: file:/C:/Dokumente und Einstellungen/Default/Eigene > > Dateien/Test/fop-0.20.5/../ > > [INFO] FOP 0.20.5 > > [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser > > [ERROR] null > > org.apache.fop.apps.FOPException > > at > > org.apache.fop.apps.CommandLineStarter.run(CommandLineStarter.java:111) > > at org.apache.fop.apps.Fop.main(Fop.java:62) > > > > --------- > > > > java.lang.NullPointerException > > at java.io.FileOutputStream.<init>(Unknown Source) > > at java.io.FileOutputStream.<init>(Unknown Source) > > at > > org.apache.fop.apps.CommandLineStarter.run(CommandLineStarter.java:101) > > at org.apache.fop.apps.Fop.main(Fop.java:62) > > > > --------- > > > > java.lang.NullPointerException > > at java.io.FileOutputStream.<init>(Unknown Source) > > at java.io.FileOutputStream.<init>(Unknown Source) > > at > > org.apache.fop.apps.CommandLineStarter.run(CommandLineStarter.java:101) > > at org.apache.fop.apps.Fop.main(Fop.java:62) > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > Use IT products in your business? Tell us what you think of them. Give us > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > afp-renderer-users mailing list > afp...@li... > https://lists.sourceforge.net/lists/listinfo/afp-renderer-users |