Package tcg.print

Examples of tcg.print.TcpLinePrinter


  public static void main(String[] args)
  {
    String printer_host = "192.168.10.200";
    int printer_port = 9100;
   
    ILinePrinter printer = new TcpLinePrinter(printer_host, printer_port);
    if (!printer.ping())
    {
      System.out.println("Remote printer " + printer_host + ":" + printer_port
                + " is not available.");
      return;
    }
   
    //initialize the calendar instance. in Unix it often throws exception because of
    //unknown locale
    try
    {
      Calendar.getInstance();
    }
    catch(Exception ex)
    {
      //ignore
    }
   
    IPrintable printable = PrintableFactory.createPrintable("OKI");
    printable.append(Calendar.getInstance().getTime().toString() + ": Hello world! köyden ağaçtan\n");
    try
    {
      printer.print(printable);
    }
    catch(RuntimeException re)
    {
      System.out.println("Exception: " + re.getMessage());
    }
   
    printable.clear();
    printable.append(Calendar.getInstance().getTime().toString() + ": abcdefghijklmnop\ndfssdfgsdgs\nssasdfdsf\n");
    try
    {
      printer.print(printable);
    }
    catch(RuntimeException re)
    {
      System.out.println("Exception: " + re.getMessage());
    }
   
    printable.clear();
    printable.append(Calendar.getInstance().getTime().toString() + ": \u65e5\u672c\u8a9e\u6587\u5b57\u5217\n");
    try
    {
      printer.print(printable);
    }
    catch(RuntimeException re)
    {
      System.out.println("Exception: " + re.getMessage());
    }
   
    printable.clear();
    printable.append(Calendar.getInstance().getTime().toString() + ": ");
    printable.append(" BOLD ", new ETextStyle[]{ ETextStyle.BOLD }, null );
    printable.append(" ITALIC ", new ETextStyle[]{ ETextStyle.ITALIC }, null );
    printable.append(" BOLD-ITALIC ", new ETextStyle[]{ ETextStyle.BOLD, ETextStyle.ITALIC }, null );
    printable.append(" UNDERLINE ", new ETextStyle[]{ ETextStyle.UNDERLINE }, null );
    printable.append(" STRIKETHROUGH ", new ETextStyle[]{ ETextStyle.STRIKETHROUGH }, null );
    printable.append(" SUPERSCRIPT ", new ETextStyle[]{ ETextStyle.SUPERSCRIPT }, null );
    printable.append(" SUBSCRIPT ", new ETextStyle[]{ ETextStyle.SUBSCRIPT }, null );
    printable.append("\n");
    try
    {
      printer.print(printable);
    }
    catch(RuntimeException re)
    {
      System.out.println("Exception: " + re.getMessage());
    }
   
    printable.clear();
    printable.append(Calendar.getInstance().getTime().toString() + ": ");
    printable.append(" DARK_GRAY ", null, EColor.DARK_GRAY );
    printable.append(" GRAY ", null, EColor.GRAY );
    printable.append(" LIGHT_GRAY ", null, EColor.LIGHT_GRAY );
    printable.append(" WHITE ", null, EColor.WHITE );
    printable.append(" MAGENTA ", null, EColor.MAGENTA );
    printable.append(" RED ", null, EColor.RED );
    printable.append(" PINK ", null, EColor.PINK );
    printable.append(" ORANGE ", null, EColor.ORANGE );
    printable.append(" YELLOW ", null, EColor.YELLOW );
    printable.append(" GREEN ", null, EColor.GREEN );
    printable.append(" CYAN ", null, EColor.CYAN );
    printable.append(" BLUE ", null, EColor.BLUE );
    printable.append("\n");
    try
    {
      printer.print(printable);
    }
    catch(RuntimeException re)
    {
      System.out.println("Exception: " + re.getMessage());
    }
View Full Code Here


  public PrintingThread(String host, int port)
  {
    if (host != null) printerHost_ = host;
    printerPort_ = port;
   
    printer = new TcpLinePrinter(printerHost_, printerPort_);
    if (!printer.ping())
    {
      System.out.println("Remote printer " + printerHost_ + ":" + printerPort_
                + " is not available.");
      printer = null;
View Full Code Here

TOP

Related Classes of tcg.print.TcpLinePrinter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.