none
GDI Printing with Remote Desktop Easy Print - Slow Speed RRS feed

  • Question

  • Hello, 

    I have been working on this for weeks and would really appreciate some guidance.  Thx in advance.  I have a 600 and 300 dpi multi-frame TIFF images that my program needs to print to a user redirected printer that uses the Windows Remote Desktop Easy Print driver (Over remote desktop session, of course). 

    The issue is speed.  Even though the method that I tried allow the program to successfully print the image, it takes about 10 seconds for the first page to start printing.

    I need to get it down to 3-5 seconds.  Has anyone faced this challenge or know what the preferred method to quickly print full page images to a redirected printer with East print driver installed?

    I am using the System.Drawing.Printing namespace.  Consuming the PrintPage event:

         Private Sub PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)

          Dim WidthAspRatio As Decimal = CDec(mPrintImage.Width / mPrintImage.Height)
            Dim HeightAspRatio As Decimal = CDec(mPrintImage.Height / mPrintImage.Width)
            Dim g As Graphics = e.Graphics
            mPrintImage.SelectActiveFrame(mFD, mOnPage)
            mLog.Log("GDIPrint: On page [" & mOnPage + 1 & "] ")
            'Rectangles in inches
            Dim ImageRectIn As RectangleF = New RectangleF(0, 0, mPrintImage.Width / mPrintImage.HorizontalResolution, mPrintImage.Height / mPrintImage.VerticalResolution)
            Dim DestRectIn As RectangleF = New RectangleF(0, 0, g.VisibleClipBounds.Width / 100, g.VisibleClipBounds.Height / 100)

            If ImageRectIn.Width > DestRectIn.Width OrElse ImageRectIn.Height > DestRectIn.Height Then

                Dim NewWidth As Single
                Dim NewHeight As Single
                If ImageRectIn.Width - DestRectIn.Width > ImageRectIn.Height - DestRectIn.Height Then
                    NewWidth = g.VisibleClipBounds.Width
                    NewHeight = HeightAspRatio * NewWidth
                Else
                    NewHeight = g.VisibleClipBounds.Height
                    NewWidth = WidthAspRatio * NewHeight
                End If
                mLog.Log("GDIPrint: About to draw image (resized) [" & mOnPage + 1 & "] on printer DC")
                g.DrawImage(mPrintImage, 0, 0, NewWidth, NewHeight)
                mLog.Log("GDIPrint: After draw image")
            Else
                mLog.Log("GDIPrint: About to draw original image [" & mOnPage + 1 & "] on printer DC")
                g.DrawImage(mPrintImage, New PointF(0, 0))
                mLog.Log("GDIPrint: After draw image")
            End If

    End Sub

    Any advice is greatly appreciated!

    Best Regards,

    Karen Sieflken


    Karen Siefken

    Monday, August 21, 2017 2:05 PM

All replies

  • Other than not knowing about the log statements I dont see anything in your vb code that slow.

    So it seems a network/printer/system issue?

    Can you print the same way with another application and it takes 3-5 secs? Or is it just this document/application?

    Also you dont show how you select the printer. Do you set it on code or have a dialog or what? Show the code for that?

    Monday, August 21, 2017 5:22 PM
  • In addition to Tommy,

    I don't know how your Remote connection is made.

    But your image is made on the server sharing with other program the memory. Then the server prints the image, over the line. Let us assume it uses a 1200 baud modem, what speed do you expect.

    Your question is completely related to the hardware, optimizing in the software would only create 0,0001% speed advantage.  

     

    Success
    Cor

    Monday, August 21, 2017 5:53 PM
  • Thanks for your message.

    The printer name is passed as an argument to the program.  I create a PrintDialog programmatically, assign the name and validate the printer.

    If I print on a local session or to a printer using a driver other than the RD Easy Print driver, then the processing  is very quick and the first page starts printing right away.

    I start out with a multi-page PCL file and convert that to a compressed multi-frame TIFF image.  The reason I am converting is that the Easy Print Driver does not support "RAW" print mode. I had to search for an alternative.  The Easy Print Driver supports GDI printing, so I went down that path originally.   There must be some kind of conversion that happens after the image is written to the printer's DC and that is what is taking a few seconds from the time my program hands of the request and the first page starts printing.

    I tried WinAPI GDI printing using BitBlt and it does not make a difference.  Just adds complexity to the code! 

    Trying to create an XPS document to see if that makes a difference.


    Karen Siefken

    Tuesday, August 22, 2017 1:47 PM
  • Thanks for your comment!  

    I printed the TIFF image from another application and it takes the same amount of time to process.  I am sure that the method that I am using is definitively not optimal to use with the Easy Print driver.  

    Bottom line is that I have to find an efficient method to send the PCL to a redirected printer on an Easy Print driver.  

    I am trying to create an XPS doc to see if it makes a difference. 


    Karen Siefken

    Tuesday, August 22, 2017 2:02 PM
  • Thanks for your message.

    The printer name is passed as an argument to the program.  I create a PrintDialog programmatically, assign the name and validate the printer.

    If I print on a local session or to a printer using a driver other than the RD Easy Print driver, then the processing  is very quick and the first page starts printing right away.

    I start out with a multi-page PCL file and convert that to a compressed multi-frame TIFF image.  The reason I am converting is that the Easy Print Driver does not support "RAW" print mode. I had to search for an alternative.  The Easy Print Driver supports GDI printing, so I went down that path originally.   There must be some kind of conversion that happens after the image is written to the printer's DC and that is what is taking a few seconds from the time my program hands of the request and the first page starts printing.

    I tried WinAPI GDI printing using BitBlt and it does not make a difference.  Just adds complexity to the code! 

    Trying to create an XPS document to see if that makes a difference.


    Karen Siefken


    "If I print on a local session or to a printer using a driver other than the RD Easy Print driver, then the processing  is very quick and the first page starts printing right away."

    What is the problem with using the very quick printer? How is it different other than the driver? Why don't you use the quick one?

    This tells me it is the printer/driver that is slow. Does the slow printer print 3-5 secs doing something else?

    However, it would not surprise me if your image has 5mb pixels that a slow printer takes 10 secs to print.

    Is the 10 secs from the time the printer receives it? ie on my HP printer when it receives the doc a light starts blinking. Then on a complex doc it might be 10 secs before the printout comes out.

    So you will need to trouble shoot in this fashion.

    Tuesday, August 22, 2017 2:14 PM
  • Users will be logging in via remote desktop and the environment is set so that all the redirected printers are on the Windows Easy print Driver.  This is to avoid having to setup every single combination of drivers on the server.  There will be many users with different types of printers.

    Thanks for the suggestion.  I will take a look at the time between [ program end print]  -- [printer blinking] - [First page printing]



    Karen Siefken

    Tuesday, August 22, 2017 4:58 PM
  • Hi Hanika,

    Have you resolved your issue now? If yes, Please remember to close your thread by marking the helpful post as answer, it is very beneficial to other community members who face the same issue.

    Thanks for your understanding.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, August 29, 2017 8:16 AM
    Moderator