printing question
- Posted by George Walters <gwalters at sc.rr.com> Aug 07, 2003
- 776 views
When I'm printing to an Epson, HP laser, HP Inkjet from a non windows computer the printout has a font and pitch size that are all the same. (however these OS's can't print to a "windows only" printer). I don't know how in Win32 to match these printouts. I select the font by using code as follows: prtOptions = getPrinter() if len(prtOptions)> 0 then printerFont = 12 -- start big charsPerLine = 0 -- init printerSize = getExtent( Printer ) -- get the size of a printer page while charsPerLine< rptWidth do setFont( Printer, "Courier New", printerFont, Normal ) fontSize = getFontSize( Printer ) -- get the font metrics charsPerLine = floor(printerSize[1]/fontSize[1]) printerFont -= 1 end while if charsPerLine>rptWidth then ptab = space(floor((charsPerLine - rptWidth)/2)) else ptab = "" end if linesPerPage = floor(printerSize[2]/fontSize[2]) The font and pitch I can match across a line, but the line spacing is off and I don't know what to do about that in a way that is not dependent on the specific printer. I increment the line I'm printing on like this: setPosition(Printer,0,line*(fontSize[2]-3)) This by trial and error (the -3) matches on an HP 890C but I doubt it might match on others. any susggestions would be appreciated thanks george