jesusvlo / XML2ESCPOS

Net Standard library that provides a simple XML Template engine with support for images, variables and loops. For ESC / POS Thermal Printers. You can print to Windows printers (using the print queue so windows takes care of waiting for it to turn on or have paper) or directly to network printers.
Mozilla Public License 2.0
3 stars 0 forks source link

How to print image to ESC/POS printer #2

Open RayCheung0616 opened 2 years ago

RayCheung0616 commented 2 years ago

Hi,

Anyone know how to print image to ESC/POS Printer ? It will very helpful if someone can give an example to print image to ESC/POS Printer.

Ray.

jesusvlo commented 2 years ago

Add nuget package: XML2ESCPOS to your project

and

Example Code:

string plantilla = "<IMAGE` PATH='wwwroot\img\logo.jpg' F='200'/>"; // replace 'wwwroot\img\logo.jpg' with your image path XML2ESCPOS.Engine xML2ESCPOS = new XML2ESCPOS.Engine { Template = plantilla, PrinterName = "Epson" // replace 'Epson' with your printer name }; XML2ESCPOS.Print();

RayCheung0616 commented 2 years ago

Thank you very much.