[Gambas-user] About Printer

Benoît Minisini gambas at ...1...
Tue Jul 19 16:10:26 CEST 2011

> Le 19 juillet 2011 15:40, Benoît Minisini
> <gambas at ...1...> a écrit :
> >> Benoit,
> >> 
> >> Paint.scale work good if there is not text ..; but if there is ...
> >> then text font size is increased by the scale too
> > 
> > This is normal. This it the goal of that matrix: everything is scaled. I
> > added a remark about that on the "How to print" wiki page.
> > 
> > And your SC() function is incorrect, as it assumes that Paint.Width and
> > Paint.Height use Point units. Which is the case in Qt apparently, but you
> > must not make such assumptions.
> well i've just say i want to talk in millimeter ... nothing more.
> I have two property ... a value in point (yes paint.height MUST to be
> always in point) and a resolution.
> i know how many point i've in one inch ... i know how many
> millimerters in one inch (25.4) so i've done a small function that
> convert
> mm in nbr points for the current painting device to match the value in mm.
> well it's not perfect ... but is there another way ? (it's the way
> used internally by gb.report)

Don't suppose that Paint.Width or Paint.Height are points. But you can be sure 
that the number of units of Paint.Width equals Printer.PaperWidth in 
millimeters (provided that FullPage is set of course).

> Then M.Cs say : what about printer natural margins ? How to know them
> ? Is there a way to retrive them ?

Logically yes, but if I didn't do it, I would say there is a problem.

Anyway, I have designed and printed a lot of report of hundreds of pages on 
many many different printers in my previous job. Trust me, you should not take 
these margins into account, and always use the full page to print.

> For exemple he have a paper pattern (caneva) he need to place exactly
> text on it ... on different printers.. but the natural printers
> margins are not taked into account .
> For reports or others, we need to be sure to start from O,O to
> pagetolalW, pagetotalH without any margins. But we need to know
> margins to alert the user when he draw sometning

This is up to the printer driver normally.

Users know there is a non-printable margin. If they don't, they will learn 
quickly at the first print. By not using what the printer driver may report 
about its margins, the user have to define its own margin, and so its printing 
will be the same whatever the printer is.

And think about generating a PDF and then sending it to the printer. When are 
the printer margins taken into account? Do you have a margin inside the PDF, 
and then another margin when printing?

So, don't use printer margins. Use user-defined margins.

Of course, if I find a way to get these printer margins accurately, I will add 
the needed properties to the Printer class.

But as I said loudly, this is not a good idea. I'm even thinking about 
removing the FullPage property and set it to TRUE by default!

Benoît Minisini

More information about the User mailing list