General Sato Barcode Printing Software

Source: Internet
Author: User

General Sato Barcode Printing Software

Sato barcode printer is a relatively easy-to-use printer. Many industrial and mining enterprises, airports, and other places with high stability and performance requirements will choose. I have not yet made it into a general bar code printing software. The Sato bar code printer does not provide a printing method similar to the driver interface. It can only use the underlying printer Instruction Set for printing. At the beginning, the problem was solved.

I posted the most critical source code, Delphi's:

1 print part

Procedure tpkfrm. writetoprinter (psprintername, psstr: string; piprintqty: integer );
VaR
Handle: thandle;
N: DWORD;
Docinfo1: tdocinfo1;
Lsprintesc: string;
Begin
// Printername: printer name (such as: Epson LQ-1600K, etc.), s for the printer ESC instruction set.
// Showmessage (inttostr (iprintbarcode) + '=' + printer. printers [iprintbarcode] + 'iprintlabel = '+ inttostr (iprintlabel ));
If not openprinter (pchar (psprintername), handle, nil) then
Createerror ('error occurred when printing the barcode! Bar Code printer '+ inttostr (getlasterror), nil, 1) cannot be obtained );
With docinfo1 do begin
Pdocname: = pchar ('sato bar code is being printed: '+ psstr );
Poutputfile: = nil;
Pdatatype: = 'Raw ';
End;

Startdocprinter (handle, 1, @ docinfo1 );
Startpageprinter (handle );

// Print command: Start
Lsprintesc: = CHR (27) + 'a ';
Writeprinter (handle, pchar (lsprintesc), length (lsprintesc), N );
// Page size
Lsprintesc: = CHR (27) + 'a1' + '000000' + '000000 ';
Writeprinter (handle, pchar (lsprintesc), length (lsprintesc), N );
// 1, 2, 3
Lsprintesc: = CHR (27) + '# E3 ';
Writeprinter (handle, pchar (lsprintesc), length (lsprintesc), N );

// Aduject start point
// S: = CHR (27) + 'a3v' + edt9.text + 'H' + edt10.text;
// Writeprinter (handle, pchar (s), length (s), N );

// Print command: bar code {BG code128
// S: = CHR (27) + 'v0020' + #27 + 'h0001 '+ #27 + 'bg04260' + '2zc100126614134523507 ';
Lsprintesc: = CHR (27) + 'v0040' + CHR (27) + 'h0001 '+ CHR (27) + 'bg000006' + psstr;
Writeprinter (handle, pchar (lsprintesc), length (lsprintesc), N );

// Print command: bar code character
Lsprintesc: = CHR (27) + 'v0320' + CHR (27) + 'h0320' + CHR (27) + 'l0101 '+ CHR (27) + 'p03' + CHR (27) + 'wb1 '+ psstr;
Writeprinter (handle, pchar (lsprintesc), length (lsprintesc), N );

// Print command: Number of copies
Lsprintesc: = CHR (27) + 'q' + inttostr (piprintqty );
Writeprinter (handle, pchar (lsprintesc), length (lsprintesc), N );

// Print command: End
Lsprintesc: = CHR (27) + 'Z ';
Writeprinter (handle, pchar (lsprintesc), length (lsprintesc), N );

Endpageprinter (handle );
Enddocprinter (handle );
Closeprinter (handle );
End;

 

2 call printing part

 

Procedure tpkfrm. printmode2 (psprintfile: string; piprintlabelqty, piprintbarcodeqty: integer );
VaR
Lioriprinterindex: integer;
Begin
Lioriprinterindex: = printer. printerindex; // Save the default printer number for recovery.

// Note: In this mode, the printer sequence number is used to automatically allocate the content to be played, so you do not need to specify a default printer.
// Specify a default printer for each input.

// Tag 1 first
// Set the printer to the default value before labeling. Note that this is very important. Instruct the user to set the correct printer for labeling.
Try
Printer. printerindex: = getprintindexfromname (sprintlabel );
Barcodeprint. loadfromfile (psprintfile );
Setlabelcolor (cdsmaster. fieldbyname ('olddesc'). asstring );
Barcodeprint. preparereport;
// Print the number of copies according to user requirements. Print two copies in a single row and one copy in a double row
Barcodeprint. printpreparedreport ('', piprintlabelqty, true, frall)
Except
Createerror ('error occurred when printing tags! Possible reasons include incorrect tag printer numbers ', nil, 1 );
End;

// 2 call the barcode again
// Before labeling, set the printer with the barcode to the default value. Note that this is very important. Instruct the user to set the correct printer for the barcode.
Try
// Printer. printerindex: = iprintbarcode;
// Print the number of copies, depending on the tag. Two bar codes are required for a tag.
Writetoprinter (sprintbarcode, cdsmaster. fieldbyname ('newpkcode'). asstring, piprintbarcodeqty); // serial number of the barcode printer, barcode content, and number of copies
Except
Createerror ('error occurred when printing the barcode! It may be because the number of the barcode printer is incorrect. ', nil, 1 );
End;

// Restore to the default printer
Try
Printer. printerindex: = lioriprinterindex;
Except
End;
End;

 

It mainly supports Sato Cl series, such as Sato cl612e barcode printer, Sato cl408e/412e barcode printer, and Sato cl608e/612e barcode printer.

 

Sato cl608e/612e barcode printer
Wide industrial bar code printer, thermal transfer/thermal method, printing speed up to 4 inch-8 inch/second,
Printing all kinds of labels, Clothing tags, washing cloth labels, or special use, pasters and other industrial and commercial applications

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.