Page 1 of 1
PureLPrint causes Windows spooler problem on local printer
Posted: Tue Jan 17, 2006 2:39 am
by TerryHough
Having a problem with Local printers. Windows spooler gives an error
when the print job is closed. Nothing ever prints.
Send the same job to a network (shared) printer and everything is
perfect.
Win98SE, Laser printer on LPT1, set as default printer.
Even tried the PureLPrint example code. Does the same thing.
Any clues?
Terry
Posted: Tue Jan 17, 2006 8:59 am
by gnozal
I use it every day with several printers, no problem(s). I must admit I use network shared printers, I don't have any local printer to test.
Do you get any error from PureLPRINT (returned value = 0) ?
What is the error returned by the Windows spooler ?
Posted: Tue Jan 17, 2006 2:40 pm
by TerryHough
I, too, use it daily with network shared printers without any problems.
Same code fails with local printers.
Example code from library chm fails on local printers with same message.
I am using Win98SE, and don't have a way to test it with WinXP.
No, there are no failure messages returned by PureLPrint. The message
is from Windows.
The printer is working fine for other Windows programs, prints a test page,
etc. without problems.
Here is an example of the code that fails:
Code: Select all
;MyPrinter.s = LPRINT_GetDefaultPrinter()
; or
MyPrinter.s = LPRINT_Requester()
If LPRINT_OpenPrinter(MyPrinter)
If LPRINT_StartDoc("Test Print Job")
LPRINT_Print("Line 1")
LPRINT_PrintN("Same Line")
LPRINT_PrintN("Line 2")
LPRINT_PrintN("")
LPRINT_PrintN("Line 4")
LPRINT_NewPage() ; Form feed
LPRINT_PrintN("Line 1 (Page 2)")
LPRINT_Print(Chr(12)) ; Page eject for Laser printers
LPRINT_EndDoc()
Else
MessageRequester("PureLPrint","Could not start job",0)
EndIf
LPRINT_ClosePrinter()
MessageRequester("PureLPrint","Done",0)
Else
MessageRequester("PureLPrint","Printer " + MyPrinter + " not found",0)
EndIf
Posted: Tue Jan 17, 2006 3:03 pm
by gnozal
If none of the PureLPRINT functions returns an error (= 0), I don't know what's wrong : it means that the API functions used in the lib [ OpenPrinter() / StartDocPrinter() / WritePrinter() / EndDocPrinter() / ClosePrinter() ] don't return any error either.
And if the job appears in the spooler before you get the error, it may be a printer driver problem. Does the printer allow raw printing ?
Do you tried several printers or just one ? Could you connect one of the working (when network connected) printers to LPT1 ?
Posted: Tue Jan 17, 2006 3:06 pm
by TerryHough
See message and code in previous post (edited)
Yes, same printer installed as a shared network printer works fine.
Installed as a local printer I get this message.
Have tried several printers, several computers. It is consistently failing.
Updated drivers on all tested printers.
Can't determined that the job ever makes it to the spooler. It never
appears (that I can tell) and certainly never prints.
Posted: Tue Jan 17, 2006 3:50 pm
by gnozal
This is weird.
If you try this code, do all the debug return 1 ?
Code: Select all
MyPrinter.s = "TEST"
If LPRINT_OpenPrinter(MyPrinter)
If LPRINT_StartDoc("Test Print Job")
Debug LPRINT_Print("Line 1")
Debug LPRINT_PrintN("Same Line")
Debug LPRINT_PrintN("Line 2")
Debug LPRINT_PrintN("")
Debug LPRINT_PrintN("Line 4")
LPRINT_EndDoc()
Else
MessageRequester("PureLPrint","Could not start job",0)
EndIf
LPRINT_ClosePrinter()
MessageRequester("PureLPrint","Done",0)
Else
MessageRequester("PureLPrint","Printer " + MyPrinter + " not found",0)
EndIf
Do you have a network printer assigned to LPT1 (like net use lpt1 ....) ?
As I have no local printer, I have done the following :
- created a Laserjet 4 printer named 'TEST' assigned to local port 'FILE:'
- executed the source above
- and I got the file below, without errors :
Line 1Same Line
Line 2
Line 4
Posted: Tue Jan 17, 2006 4:09 pm
by TerryHough
All return 1
Yes, I have several network printers and can map them to LPT1, LPT2, or
LPT3 at will.
If I print to one of the network printers, everything is perfect.
If I run the exact same program at one of the systems where the just
tested printer is attached as a local printer, I get the failure noted above.
Posted: Tue Jan 17, 2006 4:15 pm
by gnozal
Could you try to print to a file (printer attached to local port FILE:) with the same printer driver ? And see if the file is created ?
Just curious : does the code below work (added Start/EndPage) ?
Code: Select all
;MyPrinter.s = LPRINT_GetDefaultPrinter()
; or
MyPrinter.s = LPRINT_Requester()
If LPRINT_OpenPrinter(MyPrinter)
hdc = LPRINT_StartDoc("Test Print Job")
If hdc
If StartPage_(hdc)
LPRINT_Print("Line 1")
LPRINT_PrintN("Same Line")
LPRINT_PrintN("Line 2")
LPRINT_PrintN("")
LPRINT_PrintN("Line 4")
EndPage_(hdc)
EndIf
LPRINT_EndDoc()
Else
MessageRequester("PureLPrint","Could not start job",0)
EndIf
LPRINT_ClosePrinter()
MessageRequester("PureLPrint","Done",0)
Else
MessageRequester("PureLPrint","Printer " + MyPrinter + " not found",0)
EndIf
Posted: Tue Jan 17, 2006 6:12 pm
by TerryHough
Well, it doesn't give the message but it also doesn't print anything, and
no file is created.
Posted: Wed Jan 18, 2006 8:42 am
by gnozal
Well, I don't know why the same code would work with a network printer and fail with a local printer

Sorry.
Posted: Wed Jan 18, 2006 9:59 pm
by TerryHough
That makes two of us...
Further testing reveals that it fails on the Lprint_Print() or
LPrint_PrintData() commands. Selecting the default printer, opening
the printer, starting a document, ending the document, closing the printer
all work fine. Only need to remove all the actual printing!
Sure wish I could get it fixed. I wonder why the message returned
refers to a network resource. There shouldn't be any network resource
involved in printing to a local printer, only the spooler.
This has stalled a major project while I try to find a work around.
My only solution so far is to make the default printer a network printer,
but all users don't have networks. Some are single user with only a
local printer.
In all my testing I never hit this because all my printers here are
network printers. Some are "shared" on the network, others are actually
attached to the network. Never thought to test a physically attached
printer.
Posted: Fri Jan 20, 2006 8:56 am
by gnozal
TerryHough wrote:Further testing reveals that it fails on the Lprint_Print() or LPrint_PrintData() commands.
These commands are only a wrapper for the WritePrinter() API function.
In Win32.hlp, there is nothing about local or network printers.