Page 1 of 2

Printing QR code on ticketprinters

Posted: Fri Jan 23, 2026 12:23 pm
by serge_girard
Anybody knows how to print (existing) QR code on Epson (or similar) ticketprinters?

Serge

Re: Printing QR code on ticketprinters

Posted: Fri Jan 23, 2026 6:12 pm
by franco
Hi Serge, I can send a picture ... .jpg to my ticket printer star tsp100. It is wrong size, but you could resize.
I am sure you have thought of this. Maybe can work.

Re: Printing QR code on ticketprinters

Posted: Sat Jan 24, 2026 7:42 am
by serge_girard
I now use (in batch file: net use lpt1: \\pc.\EPSON) and then

Code: Select all

SET PRINTER TO LPT2
SET DEVICE  TO PRINTER
SET PRINTER ON  
? some codes
? 'my text'
// now how send JPG to ?
Serge

Re: Printing QR code on ticketprinters

Posted: Sun Jan 25, 2026 9:50 pm
by franco
Serg, I use this in my programs for printing pictures. I ran out of paper in my ticket printer so can not test right now.
But this works. Not sure if you can use. Just compile. I use 3.44.
I just went on internet and copied a sample qrcode then saved as png and jpg and put files in this folder..

Code: Select all

#include "hmg.ch"
#include "bostaurus.ch"
FUNCTION Main()
	LOCAL CImagep   :=   "serg.png"
	LOCAL Cimagej    :=  "serg.jpg"
   	IF ! FILE( cImagep ) .OR. ! FILE( cimagej)
     		 MsgInfo( "Image not found: " + cImage )
      		RETURN NIL
   	ENDIF
	SELECT HPDFDOC 'P.PDF' PAPERLENGTH 60 PAPERWIDTH 40
      	START HPDFDOC
      	START HPDFPAGE
	*SET HPDFDOC ENCODING TO "WinAnsiEncoding"
	@ 5, 2 HPDFPRINT 'Hello Serg' size 12
    	@ 15,1 HPDFPRINT IMAGE  cimagep  WIDTH 30 HEIGHT 30  type PNG
	@ 50, 10 HPDFPRINT 'Ping Style' size 12
	@ 60 ,1 HPDFPRINT IMAGE  cimagej   WIDTH 30 HEIGHT 30  type JPG 
	@ 95, 10 HPDFPRINT 'Jpg Style' size 12
	
	@ 125,2 HPDFPRINT 'Ping Style' SIZE 12
	@ 115,40 HPDFPRINT IMAGE  cimagep  WIDTH 20 HEIGHT 20  type PNG
	@ 150,2 HPDFPRINT 'Jpg Style' size 12
	@ 140,40 HPDFPRINT IMAGE  cimageJ  WIDTH 20 HEIGHT 20  type JPG



   	END HPDFPAGE
   	END HPDFDOC
   	EXECUTE FILE 'P.PDF'
RETURN NIL




Re: Printing QR code on ticketprinters

Posted: Sun Jan 25, 2026 10:09 pm
by serge_girard
Thanks! I will try as soon as I have my printer.
Serge

Re: Printing QR code on ticketprinters

Posted: Sun Jan 25, 2026 11:11 pm
by franco
Got it working. you may have to play with size. When you print you print actual size. It makes it clearer. Not sure how to program this.
I just right click in file and print. You could pick laser printer to try. I use Star tsp100 cutter printer.

Code: Select all


#include "hmg.ch"
#include "bostaurus.ch"

FUNCTION Main()
	LOCAL cPrinter := 'default' , LSUCCESS 
   	LOCAL CImagep   :=   "serg.png"
	LOCAL Cimagej    :=  "serg.jpg"
   	IF ! FILE( cImagep ) .OR. ! FILE( cimagej)
     		 MsgInfo( "Image not found: " + cImage )
      		RETURN NIL
   	ENDIF
	SELECT HPDFDOC 'P.PDF' PAPERLENGTH 60 PAPERWIDTH 40
      	START HPDFDOC
      	START HPDFPAGE
	*SET HPDFDOC ENCODING TO "WinAnsiEncoding"
	@ 5, 10 HPDFPRINT 'Hello Serg' size 16
    	@ 15,1 HPDFPRINT IMAGE  cimagep  WIDTH 30 HEIGHT 30  type PNG
	@ 50, 10 HPDFPRINT 'Ping Style' size 16
	@ 60 ,1 HPDFPRINT IMAGE  cimagej   WIDTH 30 HEIGHT 30  type JPG 
	@ 95, 10 HPDFPRINT 'Jpg Style' size 16


   	END HPDFPAGE
   	END HPDFDOC
   	EXECUTE FILE 'P.PDF'
RETURN NIL

Re: Printing QR code on ticketprinters

Posted: Mon Jan 26, 2026 1:27 am
by franco
I tested it with my Samsung phone after printing. All print outs above work. HP laser printer and star ticket printer.

Re: Printing QR code on ticketprinters

Posted: Mon Jan 26, 2026 8:10 am
by serge_girard
Thanks!

Re: Printing QR code on ticketprinters

Posted: Thu Feb 05, 2026 12:33 pm
by mol
Serge, I think that your printer uses ESC/P2 codes.
You should study documentation
https://support2.epson.net/manuals/engl ... PCOM_3.HTM
In my opinion, it would be the best generate first binary file with all you want to print and then send it to printer:

Code: Select all

function FilePrint
	param cFileName, cPrintJobTitle, cPrinter
	local aDrukarki := aPrinters()

	if cPrinter = NIL
		cPrinter := WIN_PRINTERGETDEFAULT()
	endif
	if empty(cPrinter)
		cPrinter := WIN_PRINTERGETDEFAULT()
	endif
	
	if aScan( aDrukarki, cPrinter) = 0
		cPrinter := WIN_PRINTERGETDEFAULT()
	endif
		
	if type("cPrintJobTitle") <> "C"
		cPrintJobTitle := "Wydruk z programu FAKTURY " + WersjaProgramu
	endif
	WIN_PRINTFILERAW( cPrinter, cFileName, cPrintJobTitle )
	
return .f.

Re: Printing QR code on ticketprinters

Posted: Fri Feb 06, 2026 8:01 am
by serge_girard
Thanks !

When that pirnter is my office I will continue this case,

Serge