Page 1 of 1

Printing Problem Using Version 4.51

Posted: Mon May 30, 2011 7:26 am
by Jumbuck
I have upgraded from version 4.40 to 4.51 but now find my printing routines developed under
version 4.40 will not work using version 4.51. Printer (Epson TX210) will only spit out blank pages.
Removed version 4.51 and Re-installed version 4.40 and now printing works again.
Here is example of my version 4.40 code.

Code: Select all

Procedure AssetItemListReport()
;-------------------------------------------------------
;Note! x.d must be a double for line position
;-------------------------------------------------------
;Local variables
x.d:count.i
page = 1
pagelength = 27.0                       ;A4 paper portrait
If PrintRequester()
;This small procedure eliminates gray box left behind by PrintRequester
While WindowEvent()
Wend
printwidth = PrinterPageWidth()
  If StartPrinting("PureBasic AssetItemList")
    LoadFont(6, "Times New Roman", ycm(0.2),400)             ;Bold
    LoadFont(7, "Courier New", ycm(0.2),400)                 ;Bold
    If StartDrawing(PrinterOutput())
      DrawingMode(#PB_2DDrawing_Transparent)
      DrawingFont(FontID(6))
      DrawText(xcm(0.35), ycm(1.0), "HISTORICAL/MUSEUM ASSET/ITEMS LISTING REPORT >>>>")
      DrawText(xcm(0.35), ycm(1.5), "ACCOUNT ---> " + SocietyName)
      DrawText(xcm(0.35), ycm(2.0), "As At :-   " + WorkDate)
      DrawText(xcm(16.0), ycm(2.0), "Page No, :-   "+Str(page))
      ;Print Column Heading
      DrawingFont(FontID(7))
      Item = "Number#"+Space(2)+"Asset Name"+Space(35)+"Date Acquired"+Space(1)+"Type"+Space(3)+"Category"
      DrawText(xcm(0.35), ycm(2.5), Item)
      Item = "Sourced From"+Space(29)+"Location"+Space(25)+"PictureID/Deleted"
      DrawText(xcm(0.35), ycm(3.0), Item)
      Line(xcm(0.35),ycm(3.5),printwidth,1)            ;Note for straight line last parameter is 1
      x = 4.0
      For count = 1 To numrecords
      Item = ArrayText(count)
      DrawText(xcm(0.35), ycm(x), Item)
      x = x + 0.5
      If x >= pagelength
      page = page + 1
      NewPrinterPage()
      ;Print new heading this page
      DrawingFont(FontID(6))
      DrawText(xcm(0.35), ycm(1.0), "HISTORICAL/MUSEUM ASSET/ITEMS LISTING REPORT >>>>")
      DrawText(xcm(0.35), ycm(1.5), "ACCOUNT ---> " + SocietyName)
      DrawText(xcm(0.35), ycm(2.0), "As At :-   " + WorkDate)
      DrawText(xcm(16.0), ycm(2.0), "Page No, :-   "+Str(page))
      ;Print Column Heading
      DrawingFont(FontID(7))
      Item = "Number#"+Space(2)+"Asset Name"+Space(35)+"Date Acquired"+Space(1)+"Type"+Space(3)+"Category"
      DrawText(xcm(0.35), ycm(2.5), Item)
      Item = "Sourced From"+Space(29)+"Location"+Space(25)+"PictureID/Deleted"
      DrawText(xcm(0.35), ycm(3.0), Item)
      Line(xcm(0.35),ycm(3.5),printwidth,1)            ;Note for straight line last parameter is 1
      x = 4.0
      EndIf
      Next count
      ;Don't ever forget this
      StopDrawing()
      FreeFont(6)
      FreeFont(7)
      ArrayText(0)
    EndIf
      StopPrinting()
  EndIf
EndIf
EndProcedure
Jumbuck

Re: Printing Problem Using Version 4.51

Posted: Mon May 30, 2011 11:18 am
by IdeasVacuum
Can't see anything particularly wrong with the code (though it is not very frugal).

The snag is that it depends on variables defined elsewhere in your app, so we can't test it. What error messages do you get, if any?

Re: Printing Problem Using Version 4.51

Posted: Mon May 30, 2011 2:54 pm
by walker
You have to set a drawing color (front color) as it's white by default ;-)

Re: Printing Problem Using Version 4.51

Posted: Tue May 31, 2011 5:31 am
by Jumbuck
Many thanks Walker.
FrontColor(RGB(0,0,0)) fixed the problem.
Jumbuck