Printing Problem Using Version 4.51

Just starting out? Need help? Post your questions and find answers here.
Jumbuck
User
User
Posts: 63
Joined: Mon Nov 03, 2008 8:30 am
Location: Australia

Printing Problem Using Version 4.51

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

Re: Printing Problem Using Version 4.51

Post 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?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Re: Printing Problem Using Version 4.51

Post by walker »

You have to set a drawing color (front color) as it's white by default ;-)
Jumbuck
User
User
Posts: 63
Joined: Mon Nov 03, 2008 8:30 am
Location: Australia

Re: Printing Problem Using Version 4.51

Post by Jumbuck »

Many thanks Walker.
FrontColor(RGB(0,0,0)) fixed the problem.
Jumbuck
Post Reply