Hack Forums
[Java] Printing on Receipt Printer - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Java] Printing on Receipt Printer (/showthread.php?tid=4013643)



Printing on Receipt Printer - Zanoshky - Jan 22, 2014

Hello.

Simple question : may somebody please provide a simple code to understand how to print text from TextArea to small printer used for receips in stores.

I found some code, from offical java sites for printing text. but it dosent work so well for this receipt. the code is for A4 paper printing.
Regards,
Z


* - Django - Jan 22, 2014

How old is the receipt printer? It could be that this might even be a task for ASM if I'm not mistaken.


* - Ajax1 - Jan 22, 2014

If you're talking about an actual Receipt Printer, as in specialized hardware, then I doubt that Java libraries alone will provide the requisite functionality for printing. I would recommend checking the manufacturer's website for more information regarding the printer. Post the model here maybe?
If you're talking about a regular old printer, check the Oracle APIs. I'm about to go dig through them.
Edit: is this helpful? http://docs.oracle.com/javase/7/docs/technotes/guides/jps/ http://docs.oracle.com/javase/7/docs/technotes/guides/jps/spec/JPSTOC.fm.html


* - Zanoshky - Jan 24, 2014

Those provided link, i read those already, and i use them curently in code.
This one in particular: http://docs.oracle.com/javase/tutorial/uiswing/misc/printtext.html

The printer is brand new, Epslion POS , dont know model, i dont use it, its for small restoraunt. Nothing comercial just some practice work


* - Colby_ - Jan 24, 2014

(Jan 22, 2014 08:41 PM)Ajax1 Wrote:  If you're talking about an actual Receipt Printer, as in specialized hardware, then I doubt that Java libraries alone will provide the requisite functionality for printing. I would recommend checking the manufacturer's website for more information regarding the printer. Post the model here maybe?
If you're talking about a regular old printer, check the Oracle APIs. I'm about to go dig through them.
Edit: is this helpful? http://docs.oracle.com/javase/7/docs/technotes/guides/jps/ http://docs.oracle.com/javase/7/docs/technotes/guides/jps/spec/JPSTOC.fm.html

why would a receipt printer not work for the java api?? its a printer


* - 3 Kings - Jan 24, 2014

(Jan 24, 2014 11:03 PM)Colby_ Wrote:  why would a receipt printer not work for the java api?? its a printer

I would think it would require a specialized driver for support, You could always make it work using the JNI Library and possibly coding something in ASM or C to add support yourself, wouldn't be that hard.


* - weejee - Jul 13, 2016

Look up point of sale software. There are lots of free options to choose from


* - Stealthâ„¢ - Jul 14, 2016

(Jul 13, 2016 05:03 PM)weejee Wrote:  Look up point of sale software. There are lots of free options to choose from

Please stop gravedigging.