It is currently Wed Jul 18, 2018 6:00 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 43 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Sat Jun 18, 2005 12:53 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Jun 02, 2005 3:55 am
Posts: 501
Location: U.S.A.
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jun 19, 2005 2:51 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Jun 02, 2005 3:55 am
Posts: 501
Location: U.S.A.
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!


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 - Registered PureBasic, lifetime updates user


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jun 22, 2005 2:18 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
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)

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).

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jun 23, 2005 5:32 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Jun 02, 2005 3:55 am
Posts: 501
Location: U.S.A.
Thanks for your help, again.

_________________
Intrigued - Registered PureBasic, lifetime updates user


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 28, 2006 7:44 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Update PB4 version only

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).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 28, 2006 5:53 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Jun 02, 2005 3:55 am
Posts: 501
Location: U.S.A.
Thanks for the headsup.

_________________
Intrigued - Registered PureBasic, lifetime updates user


Top
 Profile  
Reply with quote  
 Post subject: Error
PostPosted: Sat May 10, 2008 12:38 am 
Offline
User
User

Joined: Thu Dec 08, 2005 10:56 am
Posts: 24
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Error
PostPosted: Sun May 11, 2008 12:22 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
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.
There are several versions of this library (on my home page).
Did you use the right one ?
A quick test test here with PB4.10 and it works.
Code:
Debug LPRINT_GetDefaultPrinter()

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun May 11, 2008 4:24 pm 
Offline
User
User

Joined: Thu Dec 08, 2005 10:56 am
Posts: 24
Just redownloaded again.

Yes using v1.00 for pb 4.

The error occurs when using string gadgets

Code:
  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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun May 11, 2008 4:49 pm 
Offline
User
User

Joined: Thu Dec 08, 2005 10:56 am
Posts: 24
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??


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 12, 2008 3:58 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
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.
Confirmed when using LPRINT_Requester(). I never use this function myself.
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).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue May 13, 2008 12:00 am 
Offline
User
User

Joined: Thu Dec 08, 2005 10:56 am
Posts: 24
Thanks gnozal.

just done quick test and no error.

will try tomorrow on program.

Thanks again.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 16, 2008 5:17 pm 
Offline
User
User

Joined: Thu Dec 08, 2005 10:56 am
Posts: 24
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.



Code:
; 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
;


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun May 18, 2008 3:04 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
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.
Sorry, this code doesn't crash here (tested local and network printer on Win 98SE, NT4, XPsp2).
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).


Top
 Profile  
Reply with quote  
 Post subject: Problem with the Lib PureLPRINT
PostPosted: Sun Nov 23, 2008 4:09 pm 
Offline
User
User

Joined: Sun Nov 23, 2008 3:30 pm
Posts: 18
Location: Germany
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).


Code:
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()


Testsystem is WinXP SP3, PB4.2

I hope your can help find the reason of the mistake.

Cia
hjf


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 43 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye