[Gambas-user] Setting top margin of printer.
Doriano Blengino
doriano.blengino at ...1909...
Mon Apr 20 10:21:24 CEST 2009
richard terry ha scritto:
> I'm still struggling with the printer stuff.
>
> Say I have an A4 Page, and I want to write something right near the top of the
> page
>
> If I do:
>
> Dim PagePosition as integer
> Dim LeftMargin as integer = 100
> Dim FontHeight as integer
>
> 'calculate the font height
> fontHeight = Draw.TextHeight("Check the font height")
>
> 'start the page position
> PagePostition = 500
> Draw.Text("Some writing", leftMargin, pagePosition)
> PagePosition += fontHeight
> Draw.Text("Some more writing", leftMargin, pagePosition)
>
> bla bla
>
> Draw.end
>
> then the text appears at about a 1.5cm margin from the top.printed as two
> lines of text
>
> But I need to get it right up to the top for this application as it is
> printing on a pre-formatted printed form.
>
> so I set this to
>
> PagePostition = 250
>
> and do the same thing, the top row of text does not appear on the form (ie the
> printer must consider it outside of the margins.
>
>
> There seems no way to set the margins on the kde popup dialog box for an a4
> sheet.
>
You must consider two things. First, PagePosition and Leftmargin depend
on the printer resolution (which you can query from the printer
properties); "500" means something to one printer, and something else to
another. Second, a combination of printer/printer driver can work
differently from another one. You could try to draw some line, with
different starting points, to see what happens and deduce margins and
behaviours.
The best I did about this, was to have parameters for scaling and
offsets. This way you setup your print in a straightforward manner, and
then you can adapt your page to any printer by varying few parameters
and a few tries.
Regards,
Doriano
More information about the User
mailing list