Board index » Visual Studio » Slow printing

Slow printing

Visual Studio157
Anyone have any tips to speed up the print process in VB .NET. I am trying

to print an accounting batch journal, which are sometimes 5+ pages long, and

they are taking between 8-10 seconds for the print sub of the print document

to complete (VB6 version took +-1 second). Inside the PrintPage event, I am

pulling items from an array, assigning to a string, and using

graphics.drawstring to format the report:

strFormat.Alignment = StringAlignment.Near

str2Prt = aryPrt(PrintLine).F1

sngCurY = intTopMargin + (intLineCount *

fntRegular.GetHeight(grPage))

sngLenTxt = grPage.MeasureString(str2Prt, fntRegular).Width

rectF = New RectangleF(sngDataCol1, sngCurY, sngLenTxt,

fntRegular.GetHeight(grPage))

grPage.DrawString(str2Prt, fntRegular, Brushes.Black, rectF,

strFormat)



Is there a better way to do this or is there a consensus that slow printing

is the norm in .NET? Any help or comments would be appreciated. Thanks.



-Chris


-
 

Re:Slow printing

On Jul 25, 3:44 pm, ChrisH <Chr...@discussions.microsoft.com>wrote:

Quote
Anyone have any tips to speed up the print process in VB .NET. I am trying

to print an accounting batch journal, which are sometimes 5+ pages long, and

they are taking between 8-10 seconds for the print sub of the print document

to complete (VB6 version took +-1 second). Inside the PrintPage event, I am

pulling items from an array, assigning to a string, and using

graphics.drawstring to format the report:

strFormat.Alignment = StringAlignment.Near

str2Prt = aryPrt(PrintLine).F1

sngCurY = intTopMargin + (intLineCount *

fntRegular.GetHeight(grPage))

sngLenTxt = grPage.MeasureString(str2Prt, fntRegular).Width

rectF = New RectangleF(sngDataCol1, sngCurY, sngLenTxt,

fntRegular.GetHeight(grPage))

grPage.DrawString(str2Prt, fntRegular, Brushes.Black, rectF,

strFormat)



Is there a better way to do this or is there a consensus that slow printing

is the norm in .NET? Any help or comments would be appreciated. Thanks.



-Chris



Which lines are taking a long time to complete?



Thanks,



Seth Rowe



-

Re:Slow printing

Seth,



In general, it appears the drawstring takes longer, but it seems as though

the whole PrintPage process that takes longer. The example code I included

is part of select case where each line is printed according to a lineID and

an array is parsed for the data to print. I guess I am operating under the

assumption that the graphics.drawstring is the standard for printing in .NET

and there really aren't any other viable printing options. Any comments

would be appreciated. Thanks.



-Chris

"rowe_newsgroups" wrote:



Quote
On Jul 25, 3:44 pm, ChrisH <Chr...@discussions.microsoft.com>wrote:

>Anyone have any tips to speed up the print process in VB .NET. I am trying

>to print an accounting batch journal, which are sometimes 5+ pages long, and

>they are taking between 8-10 seconds for the print sub of the print document

>to complete (VB6 version took +-1 second). Inside the PrintPage event, I am

>pulling items from an array, assigning to a string, and using

>graphics.drawstring to format the report:

>strFormat.Alignment = StringAlignment.Near

>str2Prt = aryPrt(PrintLine).F1

>sngCurY = intTopMargin + (intLineCount *

>fntRegular.GetHeight(grPage))

>sngLenTxt = grPage.MeasureString(str2Prt, fntRegular).Width

>rectF = New RectangleF(sngDataCol1, sngCurY, sngLenTxt,

>fntRegular.GetHeight(grPage))

>grPage.DrawString(str2Prt, fntRegular, Brushes.Black, rectF,

>strFormat)

>

>Is there a better way to do this or is there a consensus that slow printing

>is the norm in .NET? Any help or comments would be appreciated. Thanks.

>

>-Chris



Which lines are taking a long time to complete?



Thanks,



Seth Rowe





-