Zebra GK420d label printer - status reporting - zebra-printers

I am trying to understand how I can sent status requests to these label printers to see if they are free to print labels.
The problem I have is that if I send too many label print requests then only some of get printed. I think the problem is that the memory buffer of the printer is getting overwritten and some of the labels are being deleted and not printed.
I have tried to ~HS command but can't figure out what parameter I need to check as the documentation is not very good.
Thanks in advance.

The bufferFullFlag will tell you if the printer's buffer is full and cannot receive any more print jobs. You can query that (it's the 6th parameter). You should also look at the paperOutFlag and pauseFlag to make sure the printer is ready to print.
If you use the Zebra SDK, you can call the ZebraPrinter.getCurrentStatus() and that will return a class that contains the ~HS parameters as primitive data types so that you don't have to parse it yourself. There is also a combo boolean called isReadyToPrint which looks at several of the status bits to see if you can send a job to the printer

Related

Yes/No Dialog on every page the printer will print

I'm doing this in a printer server. I am trying to make a program that will show up a Yes/No dialog box before proceeding to print a page printed by any application or from the network.
So far, it was easy to pause and resume a job. But haven't found a solution to pause and resume a page to be printed.
For reference, here's more about controlling the printer on Windows
https://msdn.microsoft.com/en-us/library/windows/desktop/ff686805(v=vs.85).aspx
I am using Windows 10 64bit. Any language will do.
Thanks.
I'm prepared to be proven wrong, but I don't believe this is trivially possible. The print spooler doesn't have a notion of where pages begin and end in a spooled print session.
The location of each page is language dependent, and the print spooler can hardly be expected to parse the stream to find the start and end of each page, it would be very slow for one thing.
The alternative would be for the print processor to note the beginning and end of each page and the offset of the spool file at that moment, and then pass that information separately to the spooler.
But there are problems with that too. the 'RAW print' capability allows the printing application to inject 'stuff' straight into the print stream, bypassing the print processor altogether. This is common with page layout applications when printing to a PostScript printer for example, particularly on Windows as supporting CMYK isn't really possible when printing on Windows, and spot colours are even harder.
The injected code can contain any number of pages and the print spooler has no way to know where each page is.
So in the general case, I don't think this is possible, at least not in the print spooler.

Zebra-printer LP 2824 not printing

I have Zebra LP2824 printer. It is working properly on Windows XP, but It is not working properly on Windows 7. On windows 7 it prints the Test page on printer properties, but it is not printing in my application. It seems, that it can't find the port, the printer is using. On the same application, but on Windows XP it is printing. I am connecting the printer with USB.
Does anyone knows what seems to be the problem?
Thanks for help in advance. :)
I usually have to share the printer in order to get it to accept a print job. Sharing in Win 7 is a little different I think - there might more than one step. Open the printer queue and pause it, then send a print job to it - see if it shows up (then un-pause) If it doesn't show up in the queue, there might be a share/permissions problem.
I just managed it today to print on another zebra USB printer.
use this article : http://support.microsoft.com/kb/322091/nl
Notice dough that the sample has a small error, so go to this function
public static bool SendFileToPrinter( string szPrinterName, string szFileName )
...
..
overthere go to then end of that function and add the line i mention below
Marshal.FreeCoTaskMem(pBytes);
fs.close(); // <-- add that or it will crash with locked files errors.
return true;
How Zebra printers behave depends a lot on what you try to print, and how the program works
For example notepad and edlin and wordpad and dos PRINT can all work different.
Some programs print RAW directly (as the url code does), others pay some respect to the printer preferences > still dough a TXT file raw printed containing ZPL commands will overrule printer settings..
ZPL is a little nightmare in itself
If you need paper to be cut
You will need
^MMC
you wont find it explained like that in their manuals.
(because they sell their own label printing design software i think..)

Slow printing in vfp using dot matrix printer (LQ-1170)

I know that this is an old topic for vfp programmers. Still, I want to ask for advices that can improve the printing time for my particular case.
I recently asked to change a report written in vfp. It use commands such as fputs, etc. The user prints this report in a dot matrix printer and of course : no problem. But the user asked for column addition and some complex calculation in the report. We tried to avoid paper size changes. So my initial solution was to rework the report using report designer, and set the page orientation to landscape. The result is so slow when printed.When I open the print queue, it even shows error - printing status!
I've tried to instal the printer driver in my local PC ( the machine where I compiled the exe) and selected this printer, both with 'save printer environment' checked and unchecked. Still the same result.
Any suggestions? Other tricks for my case are welcomed. Thanks in advance.
Sometimes, and not sure if its your case, when creating a report in VFP, it saves the printer environment based on the computer used to develop it (ie: your machine). To check, and since all reports are nothing but .DBF tables renamed, try the following. Open the report as a table
USE YourReport.frx (you have to explicitly include the .frx extension)
BROWSE
The first line in the report is your environment information that includes paper size info, orientation and even printer information. Double click in the column "Expr". The only things you probably need in this column are
ORIENTATION=1 (or 0)
it may have other stuff and look something like
DRIVER=winspool
DEVICE=\some\printershare
OUTPUT=IP_192.168.1.22
ORIENTATION=1
PAPERSIZE=1
SCALE=100
ASCII=0
COPIES=1
DEFAULTSOURCE=15
PRINTQUALITY=600
COLOR=2
DUPLEX=2
YRESOLUTION=600
TTOPTION=3
COLLATE=0
You can remove the rest of it. Next, close this column and tab over about 10 more columns to "Tag" and "Tag2". They are also MEMO type fields. Open them up. Remove ALL data out of these two columns... BUT ONLY FOR THE FIRST ROW!!!! If you open them, you would see more embedded stuff about the printer, just remove it completely. Do NOT do a global replace to blank for all rows as that will kill the report content... ONLY the first row.
All this being said, I can't guarantee, but it may be the culprit... but then again, doing direct output on old dot-matrix printers might actually be faster than all the fancy rendering the printer drivers are doing.
Trying to print a report from the report designer through the windows driver to a dotmatrix printer will never be acceptably quick.
That's why they originally did the report using commands.
Your choices are either change the printer to a laser printer (probably not possible I'm guessing) or change the report back to the old style.
It's hardly difficult to print fast on a dot matrix printer with VFP reports, you should do it on a raw mode, but not on ?? or ??? way, I mean on API calls like this:
--- RawPrint VCX ---
http://www.universalthread.com/ViewPageNewDownload.aspx?ID=9556
You can use a wrapper, with kind-of "Formats" support it's a commercial software but it's worthy if you need to do a lot of reports with this kind of printer:
--- DosPrint 4 ---
http://www.victorespina.com.ve/hs/es/index.php/DOSPrint4_%28VFP%29
(disclaimer: the developer of DosPrint 4 it's a friend of mine, and I worked with him testing and supporting on the previous version DosPrint 3 on the spanish MS-VFP newsgroups and http://Portalfox.com)
Try using the Microsoft Generic Text only print driver

Get file name when printing

Is there a way to detect the file name of a file when a user prints from any application, somwhere in the printer events? I am looking for a windows api where I can determine what file is being printed.
Print jibs are opened with names but typically this doesn't mean the filename - the names which are displayed in the print queue are accessible by querying the printer driver directly I believe.
The printer driver does not have any external API for finding the filename. I assume you would be looking at creating some kind of systray agent sort of app that would be monitoring print queues for jobs being sent. If so -
Refer to http://support.microsoft.com/kb/196805 for a microsoft tool that allows you to monitor print queues for print job status
Refer to http://msdn.microsoft.com/en-us/library/ff562742%28v=vs.85%29.aspx which explains how Windows supports printer change notifications. You can create an app that registers for this and get handle to the Print Queue. Once you get a handle you can call the GetPrinter and GetJob APIs to get access to the JOB_INFO_2 structure. The pDocumentName in the JOB_INFO_2 structure is the name of the file
Hope this helps. If so, please vote a +1 :)
No, there is not, at least not reliably. Keep in mind that there may not be a file name at all. For example, I could open an application like notepad, type some stuff, and print. What file am I printing? None.
In the above scenario most applications will provide some sort of default file name like "untitled", and sometimes you can find that name by parsing the print job's name. For example, if you call GetJob, the JOB_INFO_1 struct's pDocument member will contain a pointer to the print job's name, and that name will often contain the file name.
However, every application formats it differently, and some don't provide it at all. So the answer is you can find the file name perhaps 75% of the time with a lot of effort, but there simply is no 100% solution.

When deleting SMS, they don't get deleted

I connected a GSM/GPRS-modem to my microcontroller and everything works fine.
When I want to delete all messages in the ME storage, I should use this command:
AT+CMGD=1,4
->OK
The deleteflag '4' indicates that I want to delete all messages and flag '1' is overridden. However, when I check if the storage is empty, I get:
AT+CPMS?
+CPMS: 8,100,8,100,8,100
Indicating that the memory is still occupied and no message got deleted.
Does anyone know what I'm doing wrong?
Thanks in advance!
I use the CMGD command to delete messages.
As far as I can see the CMGR command is used to read messages and not delete them.
Edit (since you were using the CMGD command)
It is possible that your modem doesn't support multiple parameters to the CMGD command - my Siemens modem does not (or if it does it doesn't list it in the AT command set document). Instead of deleting all the messages in a single command I do a CMGL to get read messages, parse the results to get the index and them delete them one at a time using CMGD. If you do find another way I'd be interested.
Use the AT+CMGD=? command to find valid values of the parameters.
Edit (since you verified the modem supports CMGD with two parameters
I don't know what the problem is.
I did notice that your CPMS command gives different results to mine, example of mine:
AT+CPMS?
+CPMS: "SM",10,10,"MT",12,35,"MT",12,35
Yours doesn't have any storage memory string. I'm guessing the command you actually did was:
AT+CPMS="ME"
When you switch to ME storage and do a CMGL command does it list the undeleted messages?
Try to set memory to ME using "AT+CPMS="ME"" and then retry your delete command with flag=4. I guess it will work. It not then run "AT+CSAS" to save the earlier setting and the retry delete. I could not test it as there is no SMS in my ME storage area. Let me know if it worked.

Resources