Printer_Lib

Just starting out? Need help? Post your questions and find answers here.
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Printer_Lib

Post 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
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: Printer_Lib

Post by ABBKlaus »

works fine here. PB 5.20 LTS ASCII and Unicode mode tested.

Code: Select all

Print_SetDebug(#True)

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
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printer_Lib

Post by ClueLess »

thank You. it doesn't work here. I will find the problema...
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Printer_Lib

Post 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
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printer_Lib

Post 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

Code: Select all

 Print_SetUnits(#PRINT_MM)
It gives me the "constante not found: #PRINT_MM". Any Idea that can help me?

Thank You
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printer_Lib

Post 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
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Printer_Lib

Post by IdeasVacuum »

For the Image, just give the x,y,w values
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Printer_Lib

Post 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()
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: Printer_Lib

Post 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 :wink:
It is generated in the same dir as the source is in.
Last edited by ABBKlaus on Wed Oct 09, 2013 9:07 pm, edited 1 time in total.
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printer_Lib

Post 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?
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: Printer_Lib

Post 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]])
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printer_Lib

Post 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...
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: Printer_Lib

Post by ABBKlaus »

No no it was a typo by me. Corrected my post above :oops:
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printer_Lib

Post 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...
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: Printer_Lib

Post by ABBKlaus »

Where do you load that #logo ?

Please have a look at example04 image.pb
Post Reply