Task

Cause a line printer attached to the computer to print a line containing the message:    Hello World! 



Note

A line printer is not the same as standard output.

A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper.

With some systems, a line printer can be any device attached to an appropriate port (such as a parallel port).




import java.awt.print.PrinterException
import scala.swing.TextArea
 
object LinePrinter extends App {
  val (show, context) = (false, "Hello, World!")
  try // Default Helvetica, 12p
    new TextArea(context) {
      append(" in printing.")
      peer.print(null, null, show, null, null, show)
    }
  catch {
    case ex: PrinterException => ex.getMessage()
  }
  println("Document printed.")
}