ThermalDotNet icon indicating copy to clipboard operation
ThermalDotNet copied to clipboard

How to print QRCode?

Open kelputooxd opened this issue 4 years ago • 7 comments

I saw that on your website there was a receipt with QRCode there. That's what I need! If it is through the PrintImage function that you have in your project it does not seem to be working correctly because it only prints random characters ... If you can help me I would be very grateful! I need to put a QRCode in Image on the Receipt.

kelputooxd avatar Nov 19 '20 17:11 kelputooxd

The PrintImage method only prints Bitmap objects and they must be 384 pixels wide.

To print a QRCode you must generate and Bitmap object first.

There's plenty of .NET libraries to do this. For my project I used this library : https://www.nuget.org/packages/MessagingToolkit.QRCode/

yukimizake avatar Nov 20 '20 14:11 yukimizake

Can you help me? I have an image in my desktyop called qrcode.bmp, so i can use that file to the function TestImage() right? I think it's not 384 pixels, so i need to transform it to 384 right?

kelputooxd avatar Nov 20 '20 14:11 kelputooxd

Can i do something like that? Since i'ts a bmp file...

			printer.WriteLine("Test image:");
			Bitmap img = new Bitmap("../../../qrcode.bmp");
			printer.LineFeed();
			printer.PrintImage(img);
			printer.LineFeed();
			printer.WriteLine("Image OK");

kelputooxd avatar Nov 20 '20 15:11 kelputooxd

This should work, also you should run your code before posting it. ;)

How to resize an image : https://stackoverflow.com/questions/1922040/how-to-resize-an-image-c-sharp

yukimizake avatar Nov 20 '20 15:11 yukimizake

Alright thank you! Just one more thing, my english is a bit bad and i dont know the meaning of "wide" can the image be 384x384 pixels?

kelputooxd avatar Nov 20 '20 15:11 kelputooxd

Because, i tried to print the image that comes with the solutin the mono-logo and it just prints random characters.. What should i do?

kelputooxd avatar Nov 20 '20 15:11 kelputooxd

Can you please help?

kelputooxd avatar Nov 23 '20 14:11 kelputooxd