1

I need write a service that receives labels in html format via webservice(Endpoint) in a java SE application and print the same in an automated fashion by controlling the printing and return status (ie, if the document was printed successfully or not).

The problem is I need to convert the html to a print format that the printer(Zebra) accepts, (ie, postscript or image). Is this possible with xulrunner or otherwise (without ZPL Layout)?

Thank you!

JBCP
  • 13,109
  • 9
  • 73
  • 111
dhanielo
  • 23
  • 2
  • 7
  • Is xulrunner a requirement or just an idea? Other options might be to use PhantomJS to render your HTML to an image, and then send the image to the printer. – JBCP Feb 24 '14 at 17:26
  • no, xulrunner is only an idea, but is possible embedding PhantomJS in java se application and get output image buffer? – dhanielo Feb 24 '14 at 18:09
  • With PhantomJS I would suggest the easiest solution is to use System.exec() and save the output to a temporary png file, then use that. – JBCP Feb 24 '14 at 18:36
  • Possible duplicate: http://stackoverflow.com/questions/295060/embedding-xulrunner-application-on-java?rq=1 – JBCP Feb 24 '14 at 18:38

1 Answers1

0

You could try integrating PhantomJS with Java using GhostDriver:

https://github.com/detro/ghostdriver

Specifically, see the Java code here:

https://github.com/detro/ghostdriver/blob/master/binding/java/src/main/java/org/openqa/selenium/phantomjs/PhantomJSDriver.java

This library is available in Maven, so integration might be easy. You can get a screenshot with the getScreenshotAs() function.

Alternatively, see Embedding XULRunner application on Java if you want to give XULRunner a shot.

Community
  • 1
  • 1
JBCP
  • 13,109
  • 9
  • 73
  • 111