Ok i am using fop-0.20.5 and all I am trying to do is get a jpeg images and
send it to a postscript printer, i think this did work at some point but it
is difficult to tell with so many releases.  So the code looks something
like this:

  PrinterID printerID = getPrinterID();
  
  Process process = Runtime.getRuntime().exec("lp -d " +
printerID.getName());
  out1 = process.getOutputStream();
                    
  driver = new Driver(inputSource, out1);
  driver.setRenderer(Driver.RENDER_PS);

  driver.run();
  driver.reset();
  out1.flush();
  out1.close();
  process.waitFor();


In the logs i get the following error when printing the image and I have set
the java option 
-Djava.awt.headless=true.  

[ERROR] Logger not set
[INFO] Using weblogic.xml.jaxp.RegistryXMLReader as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] [1]
[INFO] [2]
[ERROR] svg graphic could not be rendered: null
java.awt.HeadlessException
        at
sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:66)
        at
org.apache.fop.render.ps.PSGraphics2D.getDeviceConfiguration(PSGraphics2D.java:872)
        at
org.apache.batik.ext.awt.image.GraphicsUtil.getDestination(GraphicsUtil.java:543)
        at
org.apache.batik.ext.awt.image.GraphicsUtil.getDestinationColorModel(GraphicsUtil.java:557)
        at
org.apache.batik.ext.awt.image.GraphicsUtil.getDestinationColorSpace(GraphicsUtil.java:579)
        at
org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:153)
        at
org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:497)
        at
org.apache.batik.gvt.RasterImageNode.primitivePaint(RasterImageNode.java:94)
        at
org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:500)
        at
org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:130)
        at
org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:500)
        at org.apache.batik.gvt.ImageNode.paint(ImageNode.java:37)
        at
org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:130)
        at
org.apache.batik.gvt.CanvasGraphicsNode.primitivePaint(CanvasGraphicsNode.java:68)
        at
org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:500)
        at
org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:130)
        at
org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:500)
        at
org.apache.fop.render.ps.PSRenderer.renderSVGDocument(PSRenderer.java:430)
        at
org.apache.fop.render.ps.PSRenderer.renderSVGArea(PSRenderer.java:365)
        at org.apache.fop.svg.SVGArea.render(SVGArea.java:58)
        at
org.apache.fop.render.ps.PSRenderer.renderForeignObjectArea(PSRenderer.java:352)
        at
org.apache.fop.layout.inline.ForeignObjectArea.render(ForeignObjectArea.java:46)
        at
org.apache.fop.render.ps.PSRenderer.renderLineArea(PSRenderer.java:813)
        at org.apache.fop.layout.LineArea.render(LineArea.java:320)
        at
org.apache.fop.render.AbstractRenderer.renderBlockArea(AbstractRenderer.java:442)
        at org.apache.fop.layout.BlockArea.render(BlockArea.java:78)
        at
org.apache.fop.render.AbstractRenderer.renderAreaContainer(AbstractRenderer.java:408)
        at org.apache.fop.layout.ColumnArea.render(ColumnArea.java:29)
        at
org.apache.fop.render.AbstractRenderer.renderSpanArea(AbstractRenderer.java:57)
        at org.apache.fop.layout.SpanArea.render(SpanArea.java:52)
        at
org.apache.fop.render.AbstractRenderer.renderBodyAreaContainer(AbstractRenderer.java:325)
        at
org.apache.fop.layout.BodyAreaContainer.render(BodyAreaContainer.java:98)
        at
org.apache.fop.render.AbstractRenderer.renderRegions(AbstractRenderer.java:494)
        at
org.apache.fop.render.ps.PSRenderer.renderPage(PSRenderer.java:839)
        at org.apache.fop.render.ps.PSRenderer.render(PSRenderer.java:1096)
        at
org.apache.fop.apps.StreamRenderer.queuePage(StreamRenderer.java:258)
        at org.apache.fop.layout.AreaTree.addPage(AreaTree.java:68)
        at
org.apache.fop.fo.pagination.PageSequence.makePage(PageSequence.java:359)
        at
org.apache.fop.fo.pagination.PageSequence.format(PageSequence.java:290)
        at
org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java:218)
        at
org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
        at
weblogic.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:585)
        at
weblogic.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java:898)
        at
weblogic.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:644)
        at
weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1008)
        at
weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
        at
weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
        at
weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
        at
weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
        at
weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at
weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
        at
weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
        at
weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:152)
        at org.apache.fop.apps.Driver.render(Unknown Source)
        at org.apache.fop.apps.Driver.run(Unknown Source)
        at
uk.gov.hmce.intelligence.centaur.component.print.Printer.print(Printer.java:151)
        at
uk.gov.hmce.intelligence.centaur.component.print.server.PrintServiceImpl.printAttachment(PrintServiceImpl.java:183)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
uk.gov.hmce.intelligence.centaur.framework.component.EJBWrapperHelper.invoke(EJBWrapperHelper.java:237)
        at $Proxy18.printAttachment(Unknown Source)

-----------------------------------------------------------------------------------------------

I also got this error the first time i printed but only the first time i try
printing a new image, so not sure if it is releated:

[ERROR] Logger not set
[WARNING] Screen logger not set - Using ConsoleLogger.
[INFO] Using weblogic.xml.jaxp.RegistryXMLReader as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] [1]
[INFO] [2]
<Jun 12, 2008 3:43:07 PM BST> <Info> <EJB> <BEA-010051> <EJB Exception
occurred during invocation from home:
[EMAIL PROTECTED]
threw exception: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
        at
org.apache.batik.ext.awt.image.spi.ImageTagRegistry.getRegistry(ImageTagRegistry.java:273)
        at
org.apache.batik.bridge.SVGImageElementBridge.createRasterImageNode(SVGImageElementBridge.java:280)
        at
org.apache.batik.bridge.SVGImageElementBridge.createGraphicsNode(SVGImageElementBridge.java:138)
        at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:182)
        at
org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:148)
        at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:76)
        at
org.apache.fop.render.ps.PSRenderer.renderSVGDocument(PSRenderer.java:388)
        at
org.apache.fop.render.ps.PSRenderer.renderSVGArea(PSRenderer.java:365)
        at org.apache.fop.svg.SVGArea.render(SVGArea.java:58)
        at
org.apache.fop.render.ps.PSRenderer.renderForeignObjectArea(PSRenderer.java:352)
        at
org.apache.fop.layout.inline.ForeignObjectArea.render(ForeignObjectArea.java:46)
        at
org.apache.fop.render.ps.PSRenderer.renderLineArea(PSRenderer.java:813)
        at org.apache.fop.layout.LineArea.render(LineArea.java:320)
        at
org.apache.fop.render.AbstractRenderer.renderBlockArea(AbstractRenderer.java:442)
        at org.apache.fop.layout.BlockArea.render(BlockArea.java:78)
        at
org.apache.fop.render.AbstractRenderer.renderAreaContainer(AbstractRenderer.java:408)
        at org.apache.fop.layout.ColumnArea.render(ColumnArea.java:29)
        at
org.apache.fop.render.AbstractRenderer.renderSpanArea(AbstractRenderer.java:57)
        at org.apache.fop.layout.SpanArea.render(SpanArea.java:52)
        at
org.apache.fop.render.AbstractRenderer.renderBodyAreaContainer(AbstractRenderer.java:325)
        at
org.apache.fop.layout.BodyAreaContainer.render(BodyAreaContainer.java:98)
        at
org.apache.fop.render.AbstractRenderer.renderRegions(AbstractRenderer.java:494)
        at
org.apache.fop.render.ps.PSRenderer.renderPage(PSRenderer.java:839)
        at org.apache.fop.render.ps.PSRenderer.render(PSRenderer.java:1096)
        at
org.apache.fop.apps.StreamRenderer.queuePage(StreamRenderer.java:258)
        at org.apache.fop.layout.AreaTree.addPage(AreaTree.java:68)
        at
org.apache.fop.fo.pagination.PageSequence.makePage(PageSequence.java:359)
        at
org.apache.fop.fo.pagination.PageSequence.format(PageSequence.java:290)
        at
org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java:218)
        at
org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
        at
weblogic.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:585)
        at
weblogic.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java:898)
        at
weblogic.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:644)
        at
weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1008)
        at
weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
        at
weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
        at
weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
        at
weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
        at
weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at
weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
        at
weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
        at
weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:152)
        at org.apache.fop.apps.Driver.render(Unknown Source)
        at org.apache.fop.apps.Driver.run(Unknown Source)
        at
uk.gov.hmce.intelligence.centaur.component.print.Printer.print(Printer.java:151)
        at
uk.gov.hmce.intelligence.centaur.component.print.server.PrintServiceImpl.printAttachment(PrintServiceImpl.java:183)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
uk.gov.hmce.intelligence.centaur.framework.component.EJBWrapperHelper.invoke(EJBWrapperHelper.java:237)
        at $Proxy18.printAttachment(Unknown Source)
        at 

-- 
View this message in context: 
http://www.nabble.com/Print-JPEG-HeadlessException---Please-Help-tp17821038p17821038.html
Sent from the FOP - Dev mailing list archive at Nabble.com.

Reply via email to