title: How to give format and print data to a ticket printer in Java
body: <p>I'm starting to do anything like this, so I need a little bit of help to start with.</p>
  
  <p>I want to print some data and give it a format to print it as an establishment ticket, so what would be the best way?</p>
  
  <ul>
  <li><p>Using the java api and create the service by myself? 
  <a href="http://docs.oracle.com/javase/tutorial/2d/printing/index.html" rel="nofollow">http://docs.oracle.com/javase/tutorial/2d/printing/index.html</a></p></li>
  <li><p>Or does it exist any free library to this purpose?</p></li>
  <li><p>Maybe better creating a PDF with the data before printing?
  I've been messing around with PDFbox API but I don't like it very much.</p></li>
  <li><p>I don't know what printer will be used so, do ticket printers use a standard size or exists differents ticket sizes?</p></li>
  <li><p>I also need to show a preview before printing it (I'm using Swing).</p></li>
  <li><p>There's no need to store the formatted data.</p></li>
  </ul>
  
  <p>Thanks in advance.</p>