Remote Printing From DotNet GDI+

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We have an application that prints a combination of text and vector graphics
using the GDI+ support in DotNet.

Everything is fine when we print to printers on the same LAN as the
application, but printing over the WAN to a remote printer is slow. I ran
some benchmarks for three cases:

· Transfering a file: 900,000 bits/sec
· Printing from our DotNet application: 225,000 bits/second = 7.5 pages/minute
· Printing an RTF file with similar content from WordPad: 560,000
bits/second = 17 pages/minute

These are based on the spool file sizes as reported in the Control Panel
printer window for the printer. These sizes are about 220KB per page in both
cases.

Also it seems that, when printing from WordPad, the spool files are of RAW
type while, presumably, when printing from DotNet they are of type EMF.

Why is printing from DotNet so slow? What do we need to do to improve the
speed by the factor of about four that seems to be potentially available?
 
Hi Howard,

Currently I am looking for somebody who could help you on it. We will reply
here with more information as soon as possible.
If you have any more concerns on it, please feel free to post here.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi

Which class do you using?
Do you mean the System.Drawing.Printing Namespace?
Can you post a simple test sample so that we can figure out what are you
doing actually?

This will help us to troubleshooting the problem.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Peter,

The printing is done from a Windows service. It uses the
System.Drawing.Printing.PrintDocument class to print documents. We call the
Print() method of this class and implement OnPrintPage() to handle each page.

Each document contains several kinds of content:
· Text, printed using System.Drawing.Graphics.DrawString()
· Simple line graphics, using System.Drawing.Graphics.DrawLine()
· Bitmaps and Windows Metafile Objects, using
System.Drawing.Graphics.DrawImage()
· More complex content, which we create in MS Word and save as RTF files.
Since we couldn’t find native support for these in the .Net framework, we
load our RTF data into a Systems.Windows.Forms.RichTextBox control and then
adapt code described at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_RichTextBox.asp
to print the contents of the control, using the Win32 EM_FORMATRANGE message.

When we print to a printer whose print server is on the local (100 MB/s)
LAN, the code runs in a very short time compared to the time to print. The
problem seems to be a lot of overhead when printing to a remote printer.
Perhaps there are some settings that can be tweaked in the managed code or
somewhere else to speed things up.

There are about 800 lines of code in the printing functionality. It will
take a while to produce a working model for you with all the
application-specific stuff taken out. Is the information above enough to
point to a solution?
 
Hello,

To perform further trouble shooting on this issue, I suggest you may test
from a simple document. For example, only including common Text or images.
Based on my experience, performance issue may be related to many issues
like network, .NET framework and managed code. If this issue was urgent, I
suggest you may contact our PSS and open a support incidence for it. They
can help to review log or perform active debug which can better trouble
shoot the problem. I attach the link for our PSS for your convennience:

http://www.microsoft.com/services/microsoftservices/supp.mspx

Luke
 
Back
Top