Page 1 of 2

QR

Posted: Wed Oct 29, 2025 1:52 am
by MIGUELON
Hello everyone, I need to print a QR code on a thermal receipt printer.
Although I can generate the QR code, when I try to print it using "dcprint bitmap filename", it doesn't work. I've tried several formats: BMP, PNG, and JPG, but it doesn't print in any of them. The receipt header logo prints without problems, and it's in JPG format.
The problem might be with the parameters @ <nSrow>, <nScol> [, <nErow>, <nEcol> ], but no matter how many times I try, the QR code doesn't appear; it just leaves a blank space. Since I urgently need to print this QR code, another solution would be to find some QR code fonts, and that's where I need help. Do you know where I can buy a QR code font?

Thanks to all.

Re: QR

Posted: Wed Oct 29, 2025 2:30 am
by SlavkoDam
Hi,
You should generate and print QR code in GIF format.

Re: QR

Posted: Wed Oct 29, 2025 5:29 am
by MIGUELON
Thanks for the suggestion, but it doesn't work in GIF format either.

Re: QR

Posted: Wed Oct 29, 2025 5:48 am
by Tom
You can't simply use a font for QR-barcodes, since they use one direction too much for fonts.

Although I use a report generator (List&Label), which is able to generate all kinds of barcodes on the fly, I still have three or four old forms created with DCPRINT there and there. It should work with

Code: Select all

 DCPRINT BITMAP <cFileName> AUTOSCALE
Don't forget to include the full path in the filename.

Re: QR

Posted: Wed Oct 29, 2025 6:59 am
by SlavkoDam
It doesn't work in GIF format either.
It is possibly a problem with DCPRINT which you use. My PowerWin library has PIMAGE() function which can print image in any format, including ICO. I use it to print QR code on a thermal receipt printer in my application for cash register. You can download test version of PowerWin library and try it.

Re: QR

Posted: Wed Oct 29, 2025 8:52 am
by rdonnay
I have never seen any problem with QR codes printing using DCPRINT.

Here is an example of a receipt that is printed by the Medallion program.
The output goes to a PDF file by using the Microsoft PDF Printer.

Code: Select all

   IF nPage == 1 .AND. Alltrim(GetFlg('FLAG32')) == 'Y'

     @ nRow -20, 10, nRow + 620, 400 DCPRINT ;
           BITMAP IniGet('RECEIPTS','ReceiptImagesPath') + '\QR-Code-(iphone)-Referral-edit.Jpg'

     @ nRow + 40, 1550, nRow + 600, 2050 DCPRINT ;
           BITMAP IniGet('RECEIPTS','ReceiptImagesPath') + '\My_Social_Media_QR-edit.Jpg'

   ENDIF
qrcode_receipt.JPG
qrcode_receipt.JPG (69.04 KiB) Viewed 2878 times

Re: QR

Posted: Wed Oct 29, 2025 10:31 am
by PedroAlex
Hello,
I've had a lot of work with QR codes.
I started by acquiring a library for that purpose. Alaska didn't have a solution.
A few years later, it's now possible to create QR codes using only Alaska-Xbase (asset available).
You can create them in any format and print them with DCprint.
But you can also simply send ESC sequences to produce the QR code on a receipt printer. ( This is the best quality and faster solution )
What do you need? Do you have an EPSON receipt printer?

You can read this post, maybe it will help.
http://bb.donnay-software.com/Donnay/vi ... E&start=10

Re: QR

Posted: Wed Oct 29, 2025 10:31 am
by MIGUELON
Hi Roger, this is my code:
QrCode(cCadenaQR,cDirectorioFicheroQR,.f.)

if file(cDirectorioFicheroQR)

/ message(cDirectorioFicheroQR)

@ dc_printerrow()-20,10,dc_printerrow()+620,400 DCPRINT BITMAP cDirectorioFicheroQR

endif
The qrCode function generates a QR code in JPG format.
As you can see, I've used your data in the row and column.

The problem is that it prints a blank copy. I'm sending you an image of what the ticket looks like. As you can see, it leaves the QR code space but doesn't print it.

Re: QR

Posted: Wed Oct 29, 2025 10:45 am
by PedroAlex
Try,

@ dc_printerrow()-20,10,dc_printerrow()+620,400 DCPRINT BITMAP cDirectorioFicheroQR AUTOSCALE CENTER

or try this

@ 00,05, 07,45 DCPRINT BITMAP cFileQRCode AUTOSCALE CENTER ( just for check if the bitmap is OK, maybe is too big )

Re: QR

Posted: Wed Oct 29, 2025 11:34 am
by Volker
Hi,

it is possible to print a QR code using esc/pos commands.

An Epson-compatible thermal printer can generate a QR code with the following code:

CHR(29)+CHR(107)+CHR(11)+CHR(76)+CHR(65)+CHR44)+"This is a test"+CHR(0)