PureLPrint causes Windows spooler problem on local printer
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
PureLPrint causes Windows spooler problem on local printer
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
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
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
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 ?
Do you get any error from PureLPRINT (returned value = 0) ?
What is the error returned by the Windows spooler ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
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:
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
Last edited by TerryHough on Tue Jan 17, 2006 3:03 pm, edited 1 time in total.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
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 ?
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 ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
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.
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.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
This is weird.
If you try this code, do all the debug return 1 ?
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 :
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
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
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
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.
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.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
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) ?
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
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Well, I don't know why the same code would work with a network printer and fail with a local printer 
Sorry.

Sorry.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
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.
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.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
These commands are only a wrapper for the WritePrinter() API function.TerryHough wrote:Further testing reveals that it fails on the Lprint_Print() or LPrint_PrintData() commands.
In Win32.hlp, there is nothing about local or network printers.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).