|
-
Aug 24th, 2009, 11:06 AM
#1
Thread Starter
New Member
Printing code or printer driver problem?
It has been a while since I reviewed some printing code in an app of mine, but doing so has resulted in some strange characteristics of printing jobs with code that has been very solid in the past.
I use an API-generated print dialog box to get parameters and set things up and then use the Printer object to print the page. Because of limitations in printer settings and limitations of some printers, I use nested looping to print consecutive pages and to control collating. Because the print job requires 14" special water-marked paper because of what is being printed, the code includes a MsgBox to prompt the user to insert this special paper in the paper slot/printer before continuing with the print job. This makes it easy to trace what is happening in the code when the app runs, althought the same thing can be confirmed running in the environment and stepping through the code. The code in outline form is as follows:
Printer Setup stuff...
For X = 1 to 2 ' total pages of printed document
For Y = 1 to number_of_copies
response& = MsgBox("Insert paper for page " & X)
Select Case X
Case 1
...sends code for 1st page of document
Case 2
...sends code for 2nd page of document
End Select
Printer.NewPage
Next
Next
Printer.EndDoc
Reset printer stuff...
Here's what happens when the code is run:
On an HP Color LaserJet 2605dn, the printer light blinks after the MsgBox prompt is answered and the print job is started, but nothing will print, no matter how long I wait. The NewPage code is sent, because the MsgBox prompt to insert paper for page 2 is seen, but the printer light continues to blink with no further action. If the 2nd MsgBox prompt is answered, the printer then starts and prints both pages without further pause. This printer is on a network connection to the controlling computer.
On an Epson Stylus Color 640 printer connected directly to the controlling computer via LPT1 the following occurs... After answering the first MsgBox prompt, the print job actually starts, but doesn't complete the first page. Approximately 2" of printing is not completed at the bottom of the page. During this process, the 2nd MsgBox prompt is received. If/When the 2nd MsgBox is answered, the first page will complete printing and the 2nd page will print to completion!
This may not seem to be a problem, but the requirement for this form is that both pages be printed front-to-back on the same piece of paper. That is another reason for the MsgBox prompts. The user can insert the water-marked paper for printing the first page, wait until that page is completed, then because of the 2nd MsgBox prompt, the print job (supposedly) will wait until the first page is completed printing and the user can take the same page, reverse it and replace it in the printer, then answer the 2nd MsgBox prompt to start the completion of the printing job.
The code is being run on an XP machine with version 6.0.98.2 of the run-time files. With these varying results from the same code on different printers, I am wondering if this is possibly due to changes in the run-time files provided by MS in various Windows updates in the last couple of years or if I seem to have some printers with genuinely interesting printer driver issues. In the past, I have actually convinced HP that they had a problem with a specific printer driver, so I know it happens.
Any perspective on this problem would be appreciated.
Ray
-
Aug 25th, 2009, 03:11 AM
#2
Re: Printing code or printer driver problem?
with the 2605 you can specify tray 1 and duplex, to automatically print both sides on a manual feed
try replacing the newpage, with enddoc, may allow the first page to finish printing
or put a pause after newpage to allow printing to finish before the message box, i would try a long pause first to see if it works then reduce to suit
different printers work differently, probably features of the drivers, rather than runtimes
Last edited by westconn1; Aug 25th, 2009 at 03:16 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 25th, 2009, 09:28 AM
#3
Thread Starter
New Member
Re: Printing code or printer driver problem?
>[QUOTE=westconn1;3591843]with the 2605 you can specify tray 1 and duplex, to automatically print both sides on a manual feed
That is true, but this app has to work for other people, the majority of whom have printers without duplex capability.
>try replacing the newpage, with enddoc, may allow the first page to finish printing
This creates other problems, as EndDoc resets several printer settings that are set up outside the printing loop, so the results differ the 2nd time around.
>or put a pause after newpage to allow printing to finish before the message box, i would try a long pause first to see if it works then reduce to suit
My understanding is that the printing code, at least for the current page, is sent completely to the printer once the NewPage code is encountered, and the printer should print regardless of what is happening in the app. That worked for years with the same app and the same code hence my question about a quirky printer driver.
As a last resort I'll probably rewrite the code to include all printer settings within the printing loop and use EndDoc for each page. Easier said than done in this case due to other considerations in the code.
Ray
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|