Method: Print - Syntax 3

Prints a barcode symbol to printer. The barcode symbol is specified by the parameters of this method. Please use the method between the Printer.BeginDoc and Printer.EndDoc methods.

Syntax:

function Print(Data: AnsiString; BarColor, SpaceColor: TColor; ShowQuietZone: Boolean; Left, Top, Module: Double; Angle: Integer = 0; BarcodeWidth: Double = 0; BarcodeHeight: Double = 0): Integer; overload; virtual;

Description:

Prints a barcode symbol that is specified by the parameters of this method to the printer.

Parameters:
Return:
Note:

The overloading method is available only for the Delphi/C++ Builder 2009 or later.

Pelase use the method between Printer.BeginDoc and Printer.EndDoc methods. For example:

Printer.BeginDoc;

... { Print other content }

Barcode_QRCode1.Print(...); { Print the barcode symbol }

... { Print other content }

Printer.EndDoc;

Note:

The method uses GetDeviceCaps function to retrieves device-specific information for the specified device. It will fail if a default printer is not set in Windows. Please ensure that a default printer is specified in Windows:

Set default printer for current application:

uses Winapi.Printers;

 

procedure SetAppPrinter(const PrinterName: string);

var

Idx: Integer;

begin

Idx := Printer.Printers.IndexOf(PrinterName);

if Idx <> -1 then

Printer.PrinterIndex := Idx

else

ShowMessage('Printer not found!');

end;

Set the global default printer.

uses Winapi.WinSpool;

 

procedure SetWindowsDefaultPrinter(const PrinterName: string);

begin

if SetDefaultPrinter(PChar(PrinterName)) then

SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0)

else

RaiseLastOSError;

end;

Contents