Printing Help
Some type ago I wrote a print utility that uses wPuts. I'm revisiting it now
because it is ungodly slow. It takes at least a minute to print one(1) full
page... totally useless for a real application. I have another OS which prints to
the same printer (hp890C) which is about 10 times faster. This routine below is
printing from a list box. Any help would be appreciated....I've no clue how to
fix the slowness.
procedure processPrint()
integer charsPerLine, linesPerPage
sequence fontSize, printerSize, stars
stars = rpt(80,'*')
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])
for j = 1 to prtOptions[3] do -- copies
tmp = startDoc(rptName&sprintf("C%d",j))
tmp = startPage()
line = 0
pageNbr =1
if pageNbr>=prtOptions[1] and pageNbr<=prtOptions[2] then
printFlag = 1
else
printFlag = 0
end if
pageNbr +=1
for i = 1 to lnCount do
tmp = getItem(idList,i)
if sch(1,tmp,"*****") = 0 then
if i = pageTable[pageNbr] then
line = 0
if printFlag = 1 then
temp = endPage()
end if
if pageNbr>=prtOptions[1] and pageNbr<=prtOptions[2]
then
printFlag = 1
temp = startPage()
setPosition(Printer,0,line*(fontSize[2])+5)
wPuts(Printer,ptab&tmp)
line += 1
else
printFlag = 0
end if
pageNbr +=1
setText(sb,"Printing Page "&sprintf("%d ",{pageNbr}))
else
if printFlag=1 then
setPosition(Printer,0,line*(fontSize[2]-6))
---<<<<<<<<<<<< THE -6 matches theos with 12
fontsize
wPuts(Printer,ptab&tmp)
line += 1
end if
end if
else
--tmp = startPage()
end if
end for
if printFlag = 1 then
temp = endPage()
end if
temp = endDoc()
end for
releasePrinter()
end if
figureLocation(0,0,"")
setFocus(idList)
end procedure
|
Not Categorized, Please Help
|
|