Hello people, I'm having trouble with a .fo file. I'm able to convert it to PDF when using the command line, but when I try to print it (using awt) thanks to embedded code, I have this error :
[INFO,Default] [PrintDocument][setupFopAndRender] loading and printing XSL-FO document file:/C:/JBoss-2.4.4_Tomcat-3.2.3/properties/JO.fo [INFO,Default] [INFO] [INFO,Default] Using org.apache.crimson.parser.XMLReaderImpl as SAX2 Parser [INFO,Default] [INFO] [INFO,Default] Using org.apache.crimson.parser.XMLReaderImpl as SAX2 Parser [INFO,Default] [INFO] [INFO,Default] Using org.apache.crimson.parser.XMLReaderImpl as SAX2 Parser [INFO,Default] [INFO] [INFO,Default] building formatting object tree [INFO,Default] [INFO] [INFO,Default] setting up fonts [ERROR,Default] org.apache.fop.apps.FOPException: Error while attempting to print document, root cause : Document root element is missing. Here is the sniplet of code I use : ... public void setupFopAndRender(String documentSource) throws FOPException, IOException { PrinterJob aPrinterJob = PrinterJob.getPrinterJob(); PrintRenderer aPrintRenderer = new PrintRenderer(aPrinterJob); URL anURL = ClassLoader.getSystemResource(documentSource); System.out.println("[PrintDocument][setupFopAndRender] loading and printing XSL-FO document " + anURL.toString()); if (anURL == null) throw new IOException("XSL-FO file could not be found.\n Check for its presence in the classpath"); InputStream anInputStream = anURL.openStream(); Options options = new Options(userConfigFile); Driver FOPDriver = new Driver(new InputSource(anInputStream), null); Logger FOPLogger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); MessageHandler.setScreenLogger(FOPLogger); FOPDriver.setLogger(FOPLogger); FOPDriver.setRenderer(aPrintRenderer); renderFop(FOPDriver); anInputStream.close(); } private synchronized void renderFop(Driver FOPDriver) throws IOException, FOPException { FOPDriver.run(); } .... What am I missing ? What's wrong with my document ? Thanks for any help Fredéric Kieffer Attached are the .fo file, and it's pdf
jo.pdf
Description: Binary data
JO.fo
Description: Binary data
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]