![]() ![]() Public static extern bool OpenPrinter( string szPrinter, out IntPtr hPrinter, IntPtr pd) This way you will be able to send ZPL to a printer no matter how it is connected ( LPT, USB, Network Share.)Ĭreate the RawPrinterHelper class (from the Microsoft article on How to send raw data to a printer by using Visual C#. Open the filestream to the lpt1 port and send the commandįileStream lpt1 = new FileStream(printer, FileAccess.ReadWrite) Aqui verifico se a impressora é válida SafeFileHandle printer = CreateFile("LPT1:", FileAccess.ReadWrite, 0, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero) Use the CreateFile external func to connect to the LPT1 port Uint dwFlagsAndAttributes, IntPtr hTemplateFile) Uint dwShareMode, IntPtr lpSecurityAttributes, FileMode dwCreationDisposition, Static extern SafeFileHandle CreateFile(string lpFileName, FileAccess dwDesiredAccess, Specifically the OP pick this function from the answers to the thread: Take a look at this thread: Print ZPL codes to ZEBRA printer using PrintDocument class.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |