The latest version was compiled with PureBasic 4.10, about 15 years ago already
This program worked for several years under Ubuntu, then the printing failed to work properly. I do not know when. Which year, or which version of Ubuntu I cannot remember.
The error: Only the top-left of the image was printed in huge size on the printer. Different printers, or even printing to PDF or SVG all gave the same results. The user "solved" this problem by using a version compiled for Windows, executed in Ubuntu using Wine
Wine is not ideal, so lately I have been playing with different Ubuntu installs, but they all gave the same results on the old binaries.
I noticed the Linux printer lib changed to GtkPrint instead of GnomePrint in PureBasic 5.40. So I tried this version with the old source code. For some odd reason, the very same thing happened there. Trying the PureBasic printer example, the same thing happened there as well. Only the top-left part of the "image" gets printed in huge size, compared to the same program running under Windows.
Tried PureBasic 6.00 as well, on different computers, with identical results. Even under fresh installs of Ubuntu 20.04 and 22.04, the PureBasic Printer.pb example does not work properly.
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Printer example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
If PrintRequester()
If StartPrinting("PureBasic Test")
LoadFont(0, "Arial", 30)
LoadFont(1, "Arial", 100)
If StartDrawing(PrinterOutput())
Debug "OutputHeight: " + OutputHeight()
Debug "OutputWidth: " + OutputWidth()
Debug "PrintHeight: " + PrinterPageHeight()
Debug "PrintWidth: " + PrinterPageWidth()
BackColor(RGB(255, 255, 255)) ; Uses white as back color, usuful when printing on a white sheet
FrontColor(RGB(0, 0, 0)) ; Use black for standard text color
Box(0, 0, 595, 842, RGB(255, 0, 0)) ; Draw a red box, becoming the outher border of the printed page.
Box(1, 1, 593, 840, RGB(0, 0, 255)) ; Draw a blue box.
Box(3, 3, 589, 836, RGB(255, 255, 255)) ; Draw a white box not to waste printer ink. Becoming the center of the printed page.
DrawingFont(FontID(0))
Debug "TextWidht: " + TextWidth("PureBasic Printer Test")
Debug "TextHeight: " + TextHeight("PureBasic Printer Test")
DrawText(100, 100, "PureBasic Printer Test")
DrawingFont(FontID(1))
Debug "TextWidht: " + TextWidth("PureBasic Printer Test 2")
Debug "TextHeight: " + TextHeight("PureBasic Printer Test 2")
DrawText(100, 400, "PureBasic Printer Test 2")
If LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/PureBasic.bmp")
DrawImage(ImageID(0), 200, 600)
Else
MessageRequester("Error","Can't load the image")
EndIf
StopDrawing()
MessageRequester("Completed","Printing completed.")
EndIf
StopPrinting()
EndIf
EndIfAs I really doubt there are some PureBasic bugs lasting for 15 years without being addressed, I hope anyone can please let me know what I am doing wrong?


