Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 51 package org.apache.fop.apps; 52 53 import org.xml.sax.XMLReader ; 55 56 import java.io.*; 58 59 import org.apache.fop.configuration.Configuration; 61 62 67 public class CommandLineStarter extends Starter { 68 69 CommandLineOptions commandLineOptions; 70 boolean errorDump; 71 72 public CommandLineStarter(CommandLineOptions commandLineOptions) 73 throws FOPException { 74 this.commandLineOptions = commandLineOptions; 75 options.setCommandLineOptions(commandLineOptions); 76 errorDump = 77 Configuration.getBooleanValue("debugMode").booleanValue(); 78 super.setInputHandler(commandLineOptions.getInputHandler()); 79 } 80 81 85 public void run() throws FOPException { 86 String version = Version.getVersion(); 87 88 log.info(version); 89 90 XMLReader parser = inputHandler.getParser(); 91 92 Driver driver = new Driver(); 93 driver.setLogger(log); 94 95 if (errorDump) { 96 driver.setErrorDump(true); 97 } 98 99 FileOutputStream output=null; 100 try { 101 output=new FileOutputStream(commandLineOptions.getOutputFile()); 102 driver.setRenderer(commandLineOptions.getRenderer()); 103 driver.setOutputStream(output); 104 driver.getRenderer().setOptions( 105 commandLineOptions.getRendererOptions()); 106 driver.render(parser, inputHandler.getInputSource()); 107 } catch (Exception e) { 108 if (e instanceof FOPException) { 109 throw (FOPException) e; 110 } 111 throw new FOPException(e); 112 } 113 finally { 114 if (output!=null) { 115 try { 116 output.close(); 117 } 118 catch(Exception e) {} 119 } 120 } 121 } 122 123 } 124 125
| Popular Tags
|