PureLPRINT library : LPRINT functions (direct LPT access)
Moderator: gnozal
gnozal, thanks for sharing this lib!
The sample file printed fine for me (on my HP Officejet 6110).
Now, I need to print a .bmp and I am wondering if, then how I could go about doing such?
I believe it to be via this function: LPRINT_PrintData(*MemoryBank, DataLength.l)
I did not see an example for that type of print job. Can you clue me in (show me an example) on how to use such?
Thanks again for the lib, it printed straight away, I like that functionality!
The sample file printed fine for me (on my HP Officejet 6110).
Now, I need to print a .bmp and I am wondering if, then how I could go about doing such?
I believe it to be via this function: LPRINT_PrintData(*MemoryBank, DataLength.l)
I did not see an example for that type of print job. Can you clue me in (show me an example) on how to use such?
Thanks again for the lib, it printed straight away, I like that functionality!
Intrigued - Registered PureBasic, lifetime updates user
For now I have found a (not as elegant, that's for sure and not fully contained code in my .dll) work around for the short term. It looks like I have some more forum reading and head-banging to do to get this lib working the way I want with concerns to the LPRINT_PrintData(*MemoryBank, DataLength.l) function.Intrigued wrote:gnozal, thanks for sharing this lib!
The sample file printed fine for me (on my HP Officejet 6110).
Now, I need to print a .bmp and I am wondering if, then how I could go about doing such?
I believe it to be via this function: LPRINT_PrintData(*MemoryBank, DataLength.l)
I did not see an example for that type of print job. Can you clue me in (show me an example) on how to use such?
Thanks again for the lib, it printed straight away, I like that functionality!
Intrigued - Registered PureBasic, lifetime updates user
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Yes, you could do it that way, but you have to know the internal printer language, in your case HP's PCL language (all the escape codes at the end of your printer's manual).Intrigued wrote:gnozal, thanks for sharing this lib!
The sample file printed fine for me (on my HP Officejet 6110).
Now, I need to print a .bmp and I am wondering if, then how I could go about doing such?
I believe it to be via this function: LPRINT_PrintData(*MemoryBank, DataLength.l)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Update PB4 version only
LPRINT_PrintData() function is back (got lost during the PB3.94 -> PB4.00 translation)
LPRINT_PrintData() function is back (got lost during the PB3.94 -> PB4.00 translation)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Error
PureLprint_ v4.0 lib
Is causing error with version 4.10 and all 4.20 beta
getting the error message
POLINK: error Unresolved external symbol '_PB_Getgadgetitemtext'
POLINK: Fatal error. 1 unresolved external.
If i comment out the code using the Lprint functions then all compiles fine & prog running..
Any help in solving this would be much appreciated, looks like the ideal solution to my printing to a receipt printer.
Thanks
Is causing error with version 4.10 and all 4.20 beta
getting the error message
POLINK: error Unresolved external symbol '_PB_Getgadgetitemtext'
POLINK: Fatal error. 1 unresolved external.
If i comment out the code using the Lprint functions then all compiles fine & prog running..
Any help in solving this would be much appreciated, looks like the ideal solution to my printing to a receipt printer.
Thanks
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: Error
There are several versions of this library (on my home page).STU-ASI wrote:Is causing error with version 4.10 and all 4.20 beta
getting the error message
POLINK: error Unresolved external symbol '_PB_Getgadgetitemtext'
POLINK: Fatal error. 1 unresolved external.
Did you use the right one ?
A quick test test here with PB4.10 and it works.
Code: Select all
Debug LPRINT_GetDefaultPrinter()
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Just redownloaded again.
Yes using v1.00 for pb 4.
The error occurs when using string gadgets
just used this code and same error
Yes using v1.00 for pb 4.
The error occurs when using string gadgets
Code: Select all
If OpenWindow(0, 216, -1, 1040, 650,"TEST", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_WindowCentered )
If CreateGadgetList(WindowID(0))
StringGadget(0,10,10,100,10,"")
StringGadget(1,10,20,100,10,"")
ButtonGadget(2,10,30,100,10,"CLICK")
CloseGadgetList()
EndIf
Repeat
Event = WaitWindowEvent()
GadgetID = EventGadget()
If GadgetID=2
printer.s=LPRINT_Requester()
If LPRINT_OpenPrinter(printer.s)
If LPRINT_StartDoc("Receipt Print")
LPRINT_PrintN("TEST LINE1")
LPRINT_PrintN(GetGadgetText(0))
LPRINT_PrintN(GetGadgetText(1))
LPRINT_EndDoc()
EndIf
LPRINT_ClosePrinter()
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ;And windowid = #window_prefs; End of the event loop
endif
just used this code and same error
OK checked this a little further and if using defaultprinter
then everything works ok.
If using the LPRINT_Requester then we get the error.
So appologies for misdirection with the stringgadet etc.
But strange that generating the error stating
POLINK error _PB_getgadgetitemtext
Thanks for help sofar gonzal
Also tried fresh install of 4.10 and getting same error??
then everything works ok.
If using the LPRINT_Requester then we get the error.
So appologies for misdirection with the stringgadet etc.
But strange that generating the error stating
POLINK error _PB_getgadgetitemtext
Thanks for help sofar gonzal
Also tried fresh install of 4.10 and getting same error??
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Confirmed when using LPRINT_Requester(). I never use this function myself.STU-ASI wrote:OK checked this a little further and if using defaultprinter
then everything works ok.
If using the LPRINT_Requester then we get the error.
I just build a special PB4.10 version : http://freenet-homepage.de/gnozal/PureLPRINT__.zip (should work, not tested)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
ok just to update this,
the requester now works as intended but i am now getting invalid memory address....
code to test below.
The error is generated at end of procedure.
also tested same code with subroutine and same error.
code without textgadgets works fine.
the requester now works as intended but i am now getting invalid memory address....
code to test below.
The error is generated at end of procedure.
also tested same code with subroutine and same error.
code without textgadgets works fine.
Code: Select all
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#String_0
#String_1
#String_2
#Button_0
#String_3
EndEnumeration
Procedure Open_Window_0()
If OpenWindow(#Window_0, 586, 176, 600, 300, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
StringGadget(#String_0, 40, 20, 250, 30, "")
StringGadget(#String_1, 40, 60, 250, 30, "")
StringGadget(#String_2, 40, 100, 250, 30, "")
ButtonGadget(#Button_0, 330, 30, 140, 80, "PRINT")
StringGadget(#String_3, 40, 160, 70, 40, "")
EndIf
EndIf
EndProcedure
Procedure printit()
def$="Yes"
type$="MEMBER"
fontA.s=""
fontB.s=""
Size1.s=""
ESC.s=Chr(27)
If def$="Yes"
printer.s=LPRINT_Requester()
Else
printer.s=LPRINT_GetDefaultPrinter()
EndIf
If LPRINT_OpenPrinter(printer.s)
If LPRINT_StartDoc("Receipt Print")
LPRINT_PrintN(Chr(28)+Chr(112)+Chr(1)+Chr(48))
LPRINT_PrintN("North Shields")
LPRINT_Print(Chr(29)+Chr(33)+Chr(32))
LPRINT_Print(Esc+Chr(33)+Chr(0))
z1$=GetGadgetText(#String_0)
t1$=Mid(z1$,FindString(z1$,":",1)+1,Len(z1$))+" : "+Str(Hour(Date()))+":"+Str(Minute(Date()))
z2$=GetGadgetText(#String_1)
z3$=GetGadgetText(#String_2)
z4$=GetGadgetText(#String_3)
LPRINT_PrintN(t1$)
LPRINT_PrintN(z2$)
If z3$="MEMBER"
t$= "00010"+" "+"Mr "+" "+"S"+" "+"Smith"+" Points : "+"0900"
Else
t$= "09999"+" "+z3$
EndIf
LPRINT_PrintN(t$)
LPRINT_PrintN("")
LPRINT_PrintN("")
LPRINT_PrintN("")
LPRINT_Print(ESC+Chr(j)+Chr(10))
LPRINT_EndDoc()
EndIf
LPRINT_ClosePrinter()
EndIf
EndProcedure
Open_Window_0()
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_Event_Gadget
If GadgetID = #String_0
ElseIf GadgetID = #String_1
ElseIf GadgetID = #String_2
ElseIf GadgetID = #Button_0
printit()
ElseIf GadgetID = #String_3
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
;
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Sorry, this code doesn't crash here (tested local and network printer on Win 98SE, NT4, XPsp2).STU-ASI wrote:ok just to update this,
the requester now works as intended but i am now getting invalid memory address....
code to test below.
The error is generated at end of procedure.
also tested same code with subroutine and same error.
code without textgadgets works fine.
I use this library every day, but never with LPRINT_Requester() though.
1. What OS / PB version do you use ?
2. Does it also crash without LPRINT_Requester() (using LPRINT_GetDefaultPrinter()) ?
If it doesn't crash without, simply build a requester yourself using LPRINT_GetInstalledPrinters() to retreive all installed printers.
3. What line does it crash ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Problem with the Lib PureLPRINT
Hello Gnozal,
thank you for your lib 'PureLPRINT'.
With your example code it work on my system fine. Now I modify the code and set the example in a procedure. The program crash in the last line of the procedure 'EndProcedure'.
The debugger message "invalid memory acces" (read error at address 0).
Testsystem is WinXP SP3, PB4.2
I hope your can help find the reason of the mistake.
Cia
hjf
thank you for your lib 'PureLPRINT'.
With your example code it work on my system fine. Now I modify the code and set the example in a procedure. The program crash in the last line of the procedure 'EndProcedure'.
The debugger message "invalid memory acces" (read error at address 0).
Code: Select all
Procedure PT()
MyPrinter.s = LPRINT_GetDefaultPrinter()
If LPRINT_OpenPrinter(MyPrinter)
Debug "Open " + MyPrinter
PrintN("Open " + MyPrinter)
If LPRINT_StartDoc("MyJob")
LPRINT_Print(Chr(27) + "E") ; PCL reset for HP Printers
LPRINT_Print("Line 1")
LPRINT_PrintN("Same Line")
LPRINT_PrintN("Line 2")
LPRINT_PrintN("")
LPRINT_PrintN("Line 4")
LPRINT_NewPage() ; Form feed
LPRINT_Print("Line 1 (Page 2)")
LPRINT_EndDoc()
Else
Debug "Could not start job"
PrintN("Could not start job")
EndIf
LPRINT_ClosePrinter()
Debug("Done!")
PrintN("Done!")
Else
Debug "Printer " + MyPrinter + " not found"
PrintN("Printer " + MyPrinter + " not found")
EndIf
EndProcedure
; MAIN
OpenConsole()
PT()
CloseConsole()
I hope your can help find the reason of the mistake.
Cia
hjf