This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes redirect output to printer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "redirect output to printer" Watch "redirect output to printer" New topic
Author

redirect output to printer

Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Ok. I have a program that prints "Hello World" in java. I want to redirect the output to my printer (and not to the console). How do I do that?


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
BTW, just to give you a background of the problem

My friend has a program written in FoxPro (remember?) that takes few inputs from the user, performs some calculations and formatting and prints a nice label on the invoice sheet (prints the calculated variables at a predefined x-y pos.)

something like:




I am trying to do the same using Java. Since my friend lives in a different geographical location and I dont know the exact x-y positions of where to print the variables, I took the following approach:



where format.bsh contains something like



I took this approach because I thought this would give my friend a good control over the format of the output variables (He can adjust them according to his needs).

Does this sound like a good approach?
[ January 30, 2007: Message edited by: Richard Green ]
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
or do you think Apache Velocity is a better fit (than BSH) for my requirements ?

or am i out of my mind and thinking in the wrong direction...
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
any one?
 
 
subject: redirect output to printer
 
Similar Threads
Smoother redirect
Difference b/w System.out.println and err.println
i/o and Streams
Java printer classes
How do I print a raw text file to any given printer port