Page 1 of 4
Printer_Lib
Posted: Tue Oct 08, 2013 6:59 pm
by ClueLess
Hi
Does anyone have experience with Printer_Lib to help me out with this code?
Code: Select all
IrsNbr.s = "000000/2013"
IRSheader.s = "Pedido / Relatório de Assistência nº: " + IrsNbr.s
Print_OpenPrinter(Print_GetDefaultPrinter())
Print_StartPrinting(IrsNbr.s)
Print_Font("arial", 12)
Print_SetTextColor(#Black)
Print_Text(0, 60, IRSheader.s)
Print_StopPrinting()
Shouldn't this code be printing the IRSheader string?? It just give me a blank page
Thank You
Re: Printer_Lib
Posted: Tue Oct 08, 2013 9:33 pm
by ABBKlaus
works fine here. PB 5.20 LTS ASCII and Unicode mode tested.
Code: Select all
Printer-Lib Version V1.10
PureBasic Version 520
Printer : HP Officejet Pro 8500 A910 (Netzwerk)
OpenPrinter_()=1
Print_SetTextAlign(0)
SetTextAlign_(62111C3,0)=0
Print_SetBkMode(1)
SetBkMode_(62111C3,1)=2
Print_SetLineColor(0)
Print_CreatePen(12200,0,0,0,0)
ExtCreatePen_(12200,5,18FF04,0,0)=55011C6
Print_CreateBrush(0)
CreateSolidBrush_(0)=61011BD
Print_CreatePen(12200,0,0,0,0)
ExtCreatePen_(12200,5,18FF0C,0,0)=55011BA
Re: Printer_Lib
Posted: Wed Oct 09, 2013 6:43 pm
by ClueLess
thank You. it doesn't work here. I will find the problema...
Re: Printer_Lib
Posted: Wed Oct 09, 2013 7:20 pm
by IdeasVacuum
It works fine here too [PB5.20 WinXPx86]
1) Using the latest Printer_Lib download?
2) Print_Text(0, 60, IRSheader.s) is right on the edge of the paper, try Print_Text(40, 60, IRSheader)
3) Try a different colour too, using RGB e.g. Print_SetTextColor(RGB(000,000,255))
4) Easiest way to test is via a virtual printer like CutePDF Writer.
5) Print_StartPrinting(IrsNbr.s) and Print_Text(60, 60, IRSheader.s) should not have the '.s' after the variables - these values have already been declared. So: Print_StartPrinting(IrsNbr) and Print_Text(60, 60, IRSheader)
6) Likewise, IRSheader.s = "Pedido / Relatório de Assistência nº: " + IrsNbr
Re: Printer_Lib
Posted: Wed Oct 09, 2013 8:00 pm
by ClueLess
ThankYou
Some How it is working.
I know about all that ".s" thing. Doesn't hurt and prevent mistakes.
Testing further commands I just found na error using
It gives me the "constante not found: #PRINT_MM". Any Idea that can help me?
Thank You
Re: Printer_Lib
Posted: Wed Oct 09, 2013 8:16 pm
by ClueLess
I really need to set a report, so all welp I can get to get this lib to work is more then Welcome...
Another command not working...
Code: Select all
Print_Image(#logo, 20, 10, 141, 67)
In case you are wondering, yes, I loaded the image before
Thank You
Re: Printer_Lib
Posted: Wed Oct 09, 2013 8:23 pm
by IdeasVacuum
For the Image, just give the x,y,w values
Re: Printer_Lib
Posted: Wed Oct 09, 2013 8:28 pm
by IdeasVacuum
Debug #PRINT_MM ;Result = 2
Print_SetUnits(#PRINT_MM) is working fine here - you are using the latest lib, for PB5.20?
Note also that you will need: iPrtUnits = Print_GetUnits()
Re: Printer_Lib
Posted: Wed Oct 09, 2013 8:46 pm
by ABBKlaus
Please post full snippets.
Are you using the lib version or the includefile ?
It seems you are missing the file "Printer_Lib_Res.res" in your Purebasic/residents folder ?
As i already told you the logfile could help
It is generated in the same dir as the source is in.
Re: Printer_Lib
Posted: Wed Oct 09, 2013 8:47 pm
by ClueLess
This is the Lib I'm using: Printer_Lib110_PB51X86. When I downloaded it it was the last one for the PB version I'm using: PureBasic 5.10 (Windows - x86).
IdeasVacuum wrote:For the Image, just give the x,y,w values
no image height?
IdeasVacuum wrote:Note also that you will need: iPrtUnits = Print_GetUnits()
Before the units?
Re: Printer_Lib
Posted: Wed Oct 09, 2013 9:03 pm
by ABBKlaus
The standard unit is mm and is set on lib-init(). You don't need to change that if you dont want to.
Code: Select all
Print_Image(Imagenr.l, x.f, y.f, [, w.f, h.f [, Mode]])
Re: Printer_Lib
Posted: Wed Oct 09, 2013 9:06 pm
by ClueLess
I'm using the Lib version. But Checking the Printer_Lib.res in the directory, found this file: Printer_Lib_Res.res. This does not look right, and may be the problema...
Re: Printer_Lib
Posted: Wed Oct 09, 2013 9:08 pm
by ABBKlaus
No no it was a typo by me. Corrected my post above

Re: Printer_Lib
Posted: Wed Oct 09, 2013 9:11 pm
by ClueLess
I'm lost now...
Any way this is my ful code:
Code: Select all
Enumeration
#logo
EndEnumeration
IrsNbr.s = "000001/2013"
IRSheader.s = "Relatório de Assistência nº: " + IrsNbr.s
OPT$ = "ORIENTATION = " + Str(#DMORIENT_PORTRAIT) + ", "
OPT$ + "PAPERSIZE = " + Str(#DMPAPER_A4)
If Print_OpenPrinter(Print_GetDefaultPrinter(), OPT$)
Print_Image(#logo, 20, 10, 141, 67)
Print_StartPrinting(IrsNbr.s)
Print_Font("trebuchet ms", 12, #PB_Font_Bold)
Print_SetTextColor(#Black)
Print_Text(100, 10, IRSheader.s)
Print_Font("trebuchet ms", 8)
Print_Text(20, 30, IRSheader.s)
Print_Line(20, 40, 180, 0)
Print_StopPrinting()
Else
MessageRequester("", "no printer available")
EndIf
Image still not printing. And by the way, I'm using the CuteFTP...
Re: Printer_Lib
Posted: Wed Oct 09, 2013 9:13 pm
by ABBKlaus
Where do you load that #logo ?
Please have a look at example04 image.pb