Win32lib printing ?

new topic     » topic index » view thread      » older message » newer message

I can't figure out what's wrong with the code stub below.
My 'puter' has two printers with obviously different metrics.
For some reason it only returns the font and page metrics of the Windows
'default' printer, NOT the printer chosen in the dialog !
To add to the confusion, it DOES return the correct metrics for the 'fax'
printer.
-----
include win32lib.ew

  integer charsPerLine, linesPerPage
  sequence  fontSize, printerSize
  sequence xx -- dummy to stop prog.

if length(getPrinter()) > 0 then
    -- pick a fixed width font
    setFont( Printer, "Courier New", 10, Normal )
    -- get the font metrics
    fontSize = getFontSize( Printer )
printf(1,"%d by %d\n",{fontSize[1],fontSize[2]})
    -- get the size of a printer page
    printerSize = getExtent( Printer )
printf(1,"%d by %d\n",{printerSize[1],printerSize[2]})
    -- how many characters can fit on a line?
    charsPerLine = floor(printerSize[1]/fontSize[1])
printf(1,"%d\n",{charsPerLine})
    -- how many lines can fit on a page?
    linesPerPage = floor(printerSize[2]/fontSize[2])
printf(1,"%d\n",{linesPerPage})
    releasePrinter()
end if

wolfritz at king.igs.net

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu