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

Re: Printer_Lib

Post by ClueLess »

So it should be Printer_Lib.res?

I changed and did not see any diference
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printer_Lib

Post by ClueLess »

Sorry. I deleted some lines before copy the code, and that line was deleted too. This is the 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)

LoadImage(#logo, "AFVCR - logo IRS.png")

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 
But still not working. Gonna check your example
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: Printer_Lib

Post by ABBKlaus »

You forgot to Register the png Decoder :!:

Code: Select all

UsePNGImageDecoder()
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printer_Lib

Post by ClueLess »

No did not. It is not just on the snipet I posted. Sorry. But it is there

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)

UsePNGImageDecoder() 
LoadImage(#logo, "AFVCR - logo IRS.png")

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

Re: Printer_Lib

Post by ABBKlaus »

Please post the logfile :twisted:
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 »

Print_Image() should be after Print_StartPrinting(). Also note that the image size values are measured in print units, not pixels - looks like you have that right, just a rather large logo.
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 »

I don't see any log file in the source directory. :cry:

I'm sorry
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 »

Code: Select all

Enumeration
  #Logo
EndEnumeration

CreateImage(#Logo,533,253,24)

If StartDrawing(ImageOutput(#Logo))

                Box(0,0,533,253,RGB(056,180,074))
        StopDrawing()
EndIf

   sIrsNbr.s = "000001/2013"
sIRSheader.s = "Relatório de Assistência nº: " + sIrsNbr
      sOPT.s = "ORIENTATION = " + Str(#DMORIENT_PORTRAIT) + ", "
      sOPT + "PAPERSIZE = " + Str(#DMPAPER_A4)

;UsePNGImageDecoder()
;LoadImage(#logo, "AFVCR - logo IRS.png")

If Print_OpenPrinter(Print_GetDefaultPrinter(), sOPT)

      Print_StartPrinting(sIrsNbr)
      Print_Image(#Logo, 20, 10, 141, 67)
      Print_Font("trebuchet ms", 12, #PB_Font_Bold)
      Print_SetTextColor(#Black)
      Print_Text(100, 10, sIRSheader)
      Print_Font("trebuchet ms", 8)
      Print_Text(20, 30, sIRSheader)
      Print_Line(20, 40, 180, 0)
      Print_StopPrinting()
Else
      MessageRequester("", "no printer available")
EndIf
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 »

Well spotted Ideasvacuum :D

Today i am ClueLess, lets continue tomorrow.
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 »

So it should be Printer_Lib.res?
It should be ....\Residents\Printer_Lib_Res.res
Edit:
I don't see any log file in the source directory.
I don't see a log file either, if I use Print_SetDebug(#True) for the above code.
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 »

Ok. we wiil continue tomorrow then if you don't mind. But how will I get the log file to be created?

@IdeasVacuum

I posted before I see your post. I'm going to create the log
Thank You
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printer_Lib

Post by ClueLess »

The libfile...

Code: Select all

Printer-Lib Version V1.10
PureBasic Version 520
Printer : CutePDF Writer
OpenPrinter_()=1
Print_SetTextAlign(0)
SetTextAlign_(DB211445,0)=0
Print_SetBkMode(1)
SetBkMode_(DB211445,1)=2
Print_SetLineColor(0)
Print_CreatePen(12200,0,0,0,0)
ExtCreatePen_(12200,5,13FF00,0,0)=8F5008C1
Print_CreateBrush(0)
CreateSolidBrush_(0)=BA10140F
Print_CreatePen(12200,0,0,0,0)
ExtCreatePen_(12200,5,13FF08,0,0)=61501AD8
ipprint_Image(0,20,10,141,67,13369376)
IsImage(0)=20379328
UseImage(0)=1627720779
GetDeviceCaps_()=#RC_BITBLT,#RC_BITMAP64,#RC_DI_BITMAP,#RC_DIBTODEV,#RC_STRETCHBLT,#RC_STRETCHDIB
ImageWidth=141
ImageHeight=67
ImageDepth=32
Using #RC_STRETCHBLT method
CreateCompatibleDC_(0)=-1878980415
SelectObject_(-1878980415,1627720779)=25493519
StretchBlt_(-618589115,472,236,3331,1583,-1878980415,0,0,141,67,13369376)=0
ipprint_Line(20,40,200,40)
LineTo_()=1
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 »

aha, the log is not saved to the folder of the exe/project, it gets saved to the parent folder of the tree......

Printer-Lib Version V1.10
PureBasic Version 520
Windows_XP
Printer : PDF995
OpenPrinter_()=1
Print_SetTextAlign(0)
SetTextAlign_(DF21349D,0)=0
Print_SetBkMode(1)
SetBkMode_(DF21349D,1)=2
Print_SetLineColor(0)
Print_CreatePen(12200,0,0,0,0)
ExtCreatePen_(12200,5,13FF34,0,0)=D8503604
Print_CreateBrush(0)
CreateSolidBrush_(0)=AF100BD7
Print_CreatePen(12200,0,0,0,0)
ExtCreatePen_(12200,5,13FF3C,0,0)=435030BF
ipprint_Image(0,20,10,141,67,13369376)
IsImage(0)=10026912
UseImage(0)=168112761
GetDeviceCaps_()=#RC_BITBLT,#RC_BITMAP64,#RC_DI_BITMAP,#RC_DIBTODEV,#RC_STRETCHBLT,#RC_STRETCHDIB
ImageWidth=533
ImageHeight=253
ImageDepth=24
Using #RC_STRETCHBLT method
CreateCompatibleDC_(0)=-603900412
SelectObject_(-603900412,168112761)=25493519
StretchBlt_(-551471971,472,236,3331,1583,-603900412,0,0,533,253,13369376)=1
ipprint_Line(20,40,200,40)
LineTo_()=1
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 »

mine got saved in the source / exe folder...
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 »

mine got saved in the source / exe folder...
Might depend on the depth of the tree.
My Path to the exe: C:\PROJECTS_DrvC\AA CODE SNIPPETS\Printing\
The log file is saved to: C:\PROJECTS_DrvC\

Edit: ... looks like the Print_Lib maybe getting the path from the .pb file attributes appended.
Edit 2: Can fix that by using SetCurrentDirectory() before the Print functions.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply