It doesn’t make sense reading through pages of instructions and code examples, trying to learn how to make project work, only to find out that when it finally does it will only run on a machine with the same or at least compatible hard and software features as the one you’re using. When you can’t make sure that people will be able to obtain a proper result by using the executable you want to distribute, what’s the point?
Nowhere is this seemingly more apparent than in the complex procedures related to printing.
Mind you, this is not a typical Gambas issue. I’ve encountered it in other programming languages as well.
That’s why I want to put the output-to-be-printed in a PDF file. That one (or SVG, or Postscript) can be used on any system using the appropriate software. Users running Linux may want to send their file to Windows, Mac, ...
So I would like to find out once and for all if it is at all possible, using the Gambas Print, Paint or Whatever Class to produce a PDF file that people can use without further problems. If not, I might as well throw in the towel.
That’s why I would like to ask you to run the following code – and eventually modify it - and see if you can obtain a ‘working’ PDF file. If you don’t want to save the file, just opt for ‘Print Preview’.
I’m curious. If that already turns out to be a problem ...
The original project can be found here (oh dear) :
https://en.wikibooks.org/wiki/Programmi ... p/Printing
' Gambas class file
Public pr1 As New Printer As "pr1"
Public Button1 As New Button(Me) As "Button1"
Public SimpleText As String
Public Sub Form_Open()
SimpleText = "Countries of the World<br><br>Papua New Guinea<br><br>Papua New Guinea is a country that is north of Australia. It has much green rainforest. It has beautiful blue seas. Its capital, located along its southeastern coast, is Port Moresby.<br><br>This is plain text in Linux Libertine 12 point.<br><br>John Smith, editor"
Me.width = 140
Me.Height = 100
With Button1
.width = 100
.height = 30
.left = 20
.top = 20
.text = "Click"
End With
End
Public Sub pr1_Draw()
Paint.Font = Font["Linux Libertine,12"] 'Turn this line Off or you won't see anything
Paint.DrawRichText(SimpleText, 10, 10) 'Original was (SimpleText,960, 960, Paint.Width - 2 * 960) what ????
End
Public Sub Button1_Click()
pr1.OutputFile = Application.path & "/Output.pdf" 'To make sure Configure is set 'Print To File'
If pr1.Configure() Then Return
pr1.Print
End