Win32lib printing ?
- Posted by wolfgang fritz <wolfritz at KING.IGS.NET> Apr 27, 2000
- 372 views
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