unit CPCL;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, PrinterLib, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm3 = class(TForm)
    btnTest: TButton;
    procedure btnTestClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.btnTestClick(Sender: TObject);
var
  Result: integer;

begin
  Result := DemPrinterCreator('HM-A300');
  IF Result = E_SUCCESS then
  begin
    Result := DemPortOpen('USB');
    IF Result = E_SUCCESS then
    begin
    //Set Size
      Result:=AddLabel(0,1000,1);

    //Set Text Underline  And Bold
      Result:=SetTextUnderline(1);
      Result:=SetTextBold(2);
      Result:=AddText(ROTATE_NONE,4,7,8,0,'Set Text Underline And Text Bold');

    //Set Normal TEXT
      Result:=SetTextUnderline(0);
      Result:=SetTextBold(0);
      Result:=AddText(ROTATE_NONE,0,0,8,56,'NORMAL TEXT');

      Result:=AddBarCodeText(1,2,0,0);
      //CODE 128
      Result:=AddBarCode(ROTATE_NONE,SYMBOL_128,2,2,50,8,98,'CODE128');

      //CODE 39
      Result:=AddBarCode(ROTATE_NONE,SYMBOL_39,2,2,50,8,176,'CODE39');

      //CODE 93
      Result:=AddBarCode(ROTATE_NONE,SYMBOL_93,2,2,50,8,252,'CODE93');

      //BARCODE
      Result:=AddBarCode(ROTATE_NONE,SYMBOL_93,2,2,50,8,328,'A1234567890A');

      //ENA13
      Result:=AddBarCode(ROTATE_NONE,SYMBOL_EAN13,2,2,50,8,400,'123456789012');

      //ENA8
      Result:=AddBarCode(ROTATE_NONE,SYMBOL_EAN8,2,2,50,8,472,'1234567');

      //QRCODE2
      Result:=AddQRCode(ROTATE_NONE,8,560,2,5,ECC_LEVEL_H,'QRCODE654321');

       //QRCODE1
      Result:=AddQRCode(ROTATE_NONE,200,560,1,5,ECC_LEVEL_H,'QRCODE123456');

        //IMAGE
      Result:=AddImage(ROTATE_NONE,200,700,'0.JPG');

       //LINE
      Result:=AddLine(8,700,8,900,2);

      //BOX
      Result:=AddBox(24,700,100,900,2);
      Result:=DemPrint();
      Result:=DemPortClose();

    end
    else
    begin
      MessageDlg('Port Open False', mtWarning, [mbOK], 0);
    end;
  end
  else
  begin
    MessageDlg('Creator False', mtWarning, [mbOK], 0);
  end;
end;

end.
