05-11-2022 07:41 AM
Thanks, Developer only provide the communication protocol, but no any passthrough interface to access it, can we use a module of USB transfer to RS232? thanks
so you mean need the printer driver developer to provide window API? thanks
05-11-2022 07:43 AM
But why the C# can communicate with the printer directly not install additional driver except windows printer driver?thanks
05-11-2022 07:54 AM
I work with Zebra printers quite a bit and what we have done is to write our own driver package as a dll which utilizes the low level Windows USB functions. Effectively we created our own driver. You will need to do the same thing in order to communicate with your printer.
05-11-2022 08:26 AM - edited 05-11-2022 08:27 AM
> C# can't communicate with printer, I used HUAWEI printer, I tried to install the VISA USB driver with NI-VISA Driver Wizard but no successful
> But why the C# can communicate with the printer directly not install additional driver except windows printer driver?
You provided inconsistent answer about C#. Please explain.
Although the driver is not Windows certified, if your company made it, you should install it.
If C# CAN communicate with the printer, we can help you "translate" it to LabVIEW.
Or, you can build the C# code into a .net assembly, we can help you call it in LabVIEW.
05-11-2022 08:29 AM
@zou wrote:
> C# can't communicate with printer, I used HUAWEI printer, I tried to install the VISA USB driver with NI-VISA Driver Wizard but no successful
> But why the C# can communicate with the printer directly not install additional driver except windows printer driver?
You provided inconsistent answer about C#. Please explain.
Although the driver is not Windows certified, if your company made it, you should install it.
If C# CAN communicate with the printer, we can help you "translate" it to LabVIEW.
Or, you can build the C# code into a .net assembly, we can help you call it in LabVIEW.
The driver may not worked. Our own internal driver we had created stopped working when we switched to Windows 10. We ultimately had to create the DLL which we created to give us USB support. Anything created using the driver wizard will be rejected by Windows unless it is signed.
05-11-2022 08:52 AM - edited 05-11-2022 08:58 AM
@Lchjxlz wrote:
But why the C# can communicate with the printer directly not install additional driver except windows printer driver?thanks
Then show us the C# code that can do that. It probably consists of accessing the aforementioned ExtEscape() function but without more detailed information from you, we can keep guessing and tossing ifs and whens in the room until the hell freezes over.
I showed a possible method which I have used in the past with other devices. It may or may not work with your specific device but you are the only person in this thread who can make an educated guess. And without more detailed information other than it is a printer and I somehow have to access its low level interface directly, we can't help you more.
The main fact so far is that using the VISA USB Raw interface is almost certainly barking up the wrong tree. It almost always is nowadays, by the way. Back in the late 90ies when VISA was introduced it seemed like a great idea to support that in VISA. But OS development and security requirements have changed significantly since then. Nowadays it is nothing more than a liability in NI VISA that should never have been released.
05-11-2022 10:21 AM
OK,thank you, I try to get the C# code which communicate with printer, and how to connecting ..I'm not sure can get it,thanks
05-12-2022 02:49 AM - edited 05-12-2022 02:57 AM
If your printer driver is a GDI based driver you may also be able to use this method:
https://docs.microsoft.com/en-us/windows/win32/printdocs/sending-data-directly-to-a-printer
The DocInfo.pDatatype = (LPTSTR)_T("RAW"); is the thing that tells the spooler to pass the data directly to the printer driver, most likely through the aforementioned ExtEscape() call. It's a higher level method but it all depends on your printer and its driver and what exactly you need to do with it to pass it directly your commands.
Converting this into LabVIEW VIs using the Call Library Node isn't that difficult but definitely some work.
05-12-2022 10:45 AM
Yes, I'm sure it's GDI based driver printer, I don't know how to use the GDI to send the command, windows GDI only print paper, can you help to show me the demo? how to use the GDI to control printer and send the command?thanks
05-12-2022 10:52 AM - edited 05-12-2022 10:54 AM
In the MSDN link I posted there is a sample code that shows what you need to do. It is C code and that means you might have to experiment a bit with C compilers. With some extra work you can also call these functions from LabVIEW through the Call Library Node but that is a bit more involved and complicated and I have the feeling it may be a bit a steep step to just jump into this.
We still have no idea what you exactly need to do and how you can reach your printer exactly through the driver interface to send it the commands you want to send. So it is still up to you to verify, test and understand what needs to be done. We can only pose options that might or might not work for your specific printer. All the rest is up to you.