Examples of LpdLinePrinter


Examples of tcg.print.LpdLinePrinter

  public static void main(String[] args)
  {
    String printer_host = "192.168.10.200";
    String printer_queue= "lp1";
   
    ILinePrinter printer = new LpdLinePrinter(printer_host, printer_queue);
    if (!printer.ping())
    {
      System.out.println("Remote printer " + printer_host + ":" + printer_queue
                + " 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
TOP
Copyright © 2018 www.massapi.com. 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.