String error;
boolean errorOccurred = false;
- public NSData convert(String foString) throws IOException, FOPException {
+ public NSData convert(NSData foData) throws IOException, FOPException {
//Construct driver
+ System.setProperty("java.awt.headless", "true");
Driver driver = new Driver();
-
+
//Setup logger
Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
driver.setLogger(logger);
driver.setOutputStream(out);
//Setup input
- InputStream in = new java.io.ByteArrayInputStream(foString.getBytes("UTF-8"));
+ InputStream in = new java.io.ByteArrayInputStream(foData.bytes(0, foData.length()));
try {
driver.setInputSource(new InputSource(in));
out.close();
}
+ if (errorOccurred) {
+ return null;
+ }
return new NSData(out.toByteArray());
}