[Gambas-user] Gambas3 Printing

Benoît Minisini gambas at ...1...
Sat Dec 4 17:06:23 CET 2010


> Hi Fabien,
> I've got printing to work ok but positioning objects on the page is
> difficult compared to Gambas2. The Paint.Width and Paint.Height values
> seem to bear no relation to pixels or mm. On A4 paper I get values of
> 559 and 760 approx. What units are used here? (My printer resolution is
> 300) Also in the hPrinter.Configure() dialog I cannot set all the printer
> options, specifically 'Orientation' is disabled. I set it in code with
> hPrinter.Orientation = Printer.Landscape but the Paint component still
> outputs in Portrait mode.
> Would appreciate any assistance.
> Regards
> Michael
> 

The Printing example comes from Gambas 2. I removed it as it does not work 
anymore with Gambas 3. If Timothy wants to port it to Gambas 3, he's welcome!

You should do all your drawings relatively to Paint.Width and Paint.Height, 
whatever their values. See it as a number of pixels, even if it is not 
necessarily true. They are floating point values, so they don't have to be 
true pixels.

The unit of an horizontal "pixel" is the width of the paper divided by 
Paint.Width. For an A4 paper on Portrait mode, it's 21 cm / Paint.Width.

The unit of a vertical "pixel" is the height of the paper divided by 
Paint.Height. For an A4 paper on Portrait mode, it's 29,7 cm / Paint.Height.

I will fix one GTK warning in next revision. But I have another one that is 
not triggered by Gambas, but by a GTK+ internal library named "libappmenu.so". 
I don't know what it is.

As you, when calling the GTK+ printer configuration dialog, I cannot change 
the orientation and the paper size. I don't know why! I must investigate...

And there is another bug in gb.qt4 printing: the font size is not resolution 
independant, whereas it should be the contrary according the documentation 
(i.e. a 50 points font is very small, as if its height is actually 50 
pixels.). I must investigate too...

Regards,

-- 
Benoît Minisini




More information about the User mailing list