I'm testing an HP LaserJet printer with WinCE7, it's a host-based (not PCL) printer.
When it's plugged into the USB port of WinCE, the USBPRN.dll is loaded but PCL.dll is not loaded which is as expected.
I included wordpad in WinCE and tried to print from wordpad, but there is a error message box saying no printer babah. Printer setting dialog box is not displayed.
Then I use CreateFile/WriteFile/CloseHandle APIs and try to send some ASCII string to the LPT1 port.
The return handles are valid but nothing happened on the printer. According to the debug log, I see something wrong inside WriteFile although the return value is valid.
Then I'm stuck.
I have several other options to try:
Use OpenPrinter/StartDocPrinter/WritePrinter API set. But I'm not
sure if they are different from CreateFile/WriteFile/CloseHandle.
Check to see if there's any open sourced driver for the printer in
Linux world, then I can see what's the data & format I should send
to the printer. But I don't know Linux at all. I'm not sure what
part is different from Windows to Linux or what part is same to
different OS.
Anyone can point out any information about how to implement a
host-based printer driver? Just introduction about the architecture
is also welcome. For example, is there anything related to the
device context (DC) or bitmap or anything else.
I'd like to see any comment on which direction I should go.
Thanks,
Fei
Related
I have my original question posted here:
Delphi Printer Access
Now we need to handle one more case of network printer with specific IP say xx.xx.x.x .
How Do we access Network printer from Delphi for Rewrite function?
I did sample app with this code and it works for all printers:
AssignPrn(lOutputFile);
Rewrite(lOutputFile);
for liIndex := 0 to lsLines.Count-1 do
Writeln(lOutputFile, lsLines[liIndex]);
CloseFile(lOutputFile);
On click of f7 on CloseFile(lOutputFile); in sample app, control goes nowhere and printing works.
When I integrated my code in the main application
On click of f7 on CloseFile(lOutputFile) it goes got o Devexpress files and its not printing.
kindly suggest.
Windows can access network printers. See the documentation.
Once the printer is installed, your application can access that printer just like any other [local] printer.
Use a fully qualified function name: System.CloseFile(lOutputFile);
I'm using a service on multiple computers that is essentially a socket and TcpListener that listens on a port for a message. This message is a byte array of ZPL code. The service then sends this array to a USB connected Zebra GK420d printer and then prints it. The byte array is sent from another application where users select different label layouts for different products. The other computers do not have admin privileges but i do not think this is the cause.
I've got the printers working on the computer at my desk and one other computer, but on other computers (about 10 more) it doesn't . All computers have a connected USB Zebra GK420d printer.
The issue I'm having is the printers flash green once, but it does not print. I know for a fact the service works fine, as when I view a CMD window, I see the ZPL message and the printer it is trying to send to. This suggests the service works and the printer gets the message, hence the flash.
I've tried a variety of drivers, updating the drivers, different USB ports, updating the .Net on the computers, deleting the printers and reinstalling them etc but nothing seems to be fixing the issue. They print test pages fine so i'm not sure what the issue is.
The computers/printers all now have identical printer properties / preferences / drivers and Windows version. However the printers were all bought at different times over the last 6 years.
I strongly recommend using the text based driver. If you are sending ZPL, that's the the cleanest option. If it didn't work before, try a simpler label/ZPL blob; there could be something wrong with the ZPL you are sending.
Else, I found this: https://code-examples.net/en/q/43c80a
Right-click on the Printer and choose "Properties".
On the "General" tab, click on the "Printing Preferences..." button.
On the "Advanced Setup" tab, click on the "Other" button.
Make sure there is a check in the box labeled "Enable Passthrough Mode".
Make sure the "Start sequence:" is "${".
Make sure the "End sequence:" is "}$".
Click on the "Close" button.
Click on the "OK" button.
Click on the "OK" button.
In code, add "${" to the beginning of ZPL and "}$" to the end. This is with the Windows driver for ZDesigner.
Turns out it was due to the ZPL code not having a new line at the end of each ZPL file that got sent over the stream.
I am working with MC9500 Motorola handhelds, Zebra RW-420 printers, and the VIP Application. When I go to print a test page it reads the error:
Failed to read 1 byte(0 read)
Troubleshooting:
-I have successfully printed from other RW-420 printers
-Sent the printers that had this error back to Zebra(now they can print via Bluetooth but still show that error)
-Made sure I have the correct COM Ports
-Reset the printers multiple times on the Zebra Setup Utilities
-I have updated the firmware on the printer
-Tried changing the printer language but nothing helps
I have tried searching for this error but I haven't seen anything relevant yet. Please let me know if there is anything I am missing.
There was a different way to change the printer language and a few other configuration settings that needed to be changed beforehand.
How would I send a CPCL or ZPL command to a Zebra printer through an app?
These commands would be similar to ones used in ToolBox.
For example how would I send "! U1 getvar "allcv"" to a printer and get the results.
I am using the Link-OS ios SDK and already have no problems connecting to and printing to the printers.
Did you ever figure this out? It's quite simple in the *nix world. If you send commands to the lp port via cat or some such, the printer will simply read them in. Note that this must be done as root if you don't have permissions set up on the device to allow normal users.
$ sudo cat command_file.txt > /dev/usb/lp0
So, I'm not a C or C++ developer, but the idea is the same in any language. Open the file for writing (probably O_RDWR so you can read back in any response from the printer) and then send commands to the fd returned from open().
You didn't specify an OS so I'll just stick with this *nix answer. That said, it wouldn't be different in Windows, I suppose. You just have to be able to find the right device.
I need some help in building printer driver. The printer connects to system via serial port. I just need to grab the data that application sends to the printer, compress it (its a custom routine) and send it to printer.
I do not have any experience in developing drivers. I have all the tools, SDK, DDK. If someone could point out some link to a sample driver (that could just write to flat file instead of sending to printer) that would be great.
The driver has to run on windows NT.
So basically i am looking for some sample printer driver, the DDK (with the name of winprint) has one but when i compile and link it, it generates dll file instead of sys.
Please not once again that the WDK wont work as this driver would be running on NT.
You should use the Win NT DDK. It would have sample files. Also in Windows NT, the printer driver files are actually .dll files and not .sys files. Printer drivers are a different category of drivers in Win NT and need to be installed using the Add Printer Wizard and in a package form with an INF file.
If you already have the Win NT DDK, you could use the sample TTY driver that is present. I believe this is available in %DDKROOT%\Src\Print\Mini\Txtonly.
This article talks more about some update to this driver - http://support.microsoft.com/kb/289108
Once you are able to install and run this driver, you should be able to see the main code and add in your own code to get the incoming data and stream it to a file.
Hope this helps. If so, +1 :)
You don't need to modify code to get a driver that can write to a flat file.
A Windows printer driver can be connected to a variety of ports. In particular you can create a Local Port that is actually connected to a file. On the printer's Ports tab, click [Add Port] and then select Local Port and click [New Port]. In the 'Enter port name' edit-text control type the path of the file you want to be filled with PDL data. Then every time you print subsequently, the PDL from the driver will be written to the file associated with the new port, overwriting its previous contents.