blenkhn has asked for the wisdom of the Perl Monks concerning the following question:

I would like to use win32:printer to format a page for output on a dotmatrix printer.

using the write command how do I center the text on each other?

For example how would I center vertically the following 2 lines? I would also like to use 2 different fonts and sizes.
Hello World!
Planet Earth, Milky Way

Can you also explain what the $w is for, it is not explained in the documentation. $dc->Write2($text, $x, $y, $w, [$flags, [$indento, [$hspace, $vspace]]]); Thanks in advance for any help you can give.

Replies are listed 'Best First'.
Re: win32::printer help needed
by BrowserUk (Patriarch) on Apr 09, 2008 at 19:23 UTC

    Use the Write() (not Write2()), and specify the CENTER format flag. You could use either the string mode (And set x to 0; Y to line number * font hieght in pixels) or the Draw mode and specify the bounding box where you want the text centered.

    See also the Fit() method which will do some of the calculations for you.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Can you give me an example? It would be very much appreciated.