Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing String instead of from a file  RSS feed

 
Edward Bloom
Ranch Hand
Posts: 34
Eclipse IDE Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy!

Im new at Java and I've got this code:



Now this method got the text from a file at the second attribute.
I have to change the comPrinter method. I would like to send the text String to the printer instead of reading it from a file.

Like this:

String text = "^XA\r\n^FO186,129^A0N,16,25^FDtext^FS\r\n^FS\r\n^PQ1\r\n^XZ";
comPrinter("COM1", text);

Does someone have any idea how to change this code?
Thank you in advance for any help you can provide.
 
Edward Bloom
Ranch Hand
Posts: 34
Eclipse IDE Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy!

I was lazy to think but now i solwed it:

And then:


Sry for the posting. ^^"

Happy New Year!
 
Tony Docherty
Bartender
Posts: 3264
81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sry for the posting. ^^"

No problem. Well done for solving it yourself and thanks for posting the solution.

Happy New Year!

And to you.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!