Speed up alternating between printer trays for Crystal Reports in vb.net

Hello Everyone,

I have a program written in VB.NET 2008 and I need to alternate back and forth between paper trays for our Crystal Reports (Crystal Reports 2013); every other page needs to be on yellow paper. All of the vb.net calls using the Crystal ReportDocument do not work.  

Here in Experts Exchange, I found the reason for my problem (it seems to be a Crystal issue with their API calls) but I also found a "brute force" workaround.

The solution that I found was a 5 year old post here in Experts Exchange:
Experts Exchange > Database > DB Reporting Tools > Crystal Reports > Select printer tray for Crystal Report
However, on our HP 8150 printer the workaround is unacceptably slow in switching printer drivers.

This is the workaround submitted by byundt:
"A brute force workaround I have used when printing from Excel is to install more than one instance of a printer. You can then adjust the default settings on the new instance of the printer so that you get the paper tray you need. Then all you need to do programmatically is to choose which printer instance you want to use."

It worked perfect at almost normal speed on our Minolta Bizhub C650, but it is way too slow on our HP 8150.

Does anyone know how to speed this up; or am I doomed on this printer and it's inability to quickly respond to the driver change?

Here is the code that I am using (where intI is the report that needs to be yellow and gcrReport is the ReportDocument):

Dim Printer As New System.Drawing.Printing.PrinterSettings
strPrinterName = Printer.PrinterName

If strPrinterName.Contains("8150") Then
      If intI = 2 Then
            gcrReport.PrintOptions.PrinterName = "8150_Yellow"
      Else
            gcrReport.PrintOptions.PrinterName = strPrinterName
      End If
      gcrReport.PrintToPrinter(1, False, 0, 0)
ElseIf strPrinterName.Contains("C650") Then
      If intI = 2 Then
            gcrReport.PrintOptions.PrinterName = "Bizhub C650_Yellow"
      Else
            gcrReport.PrintOptions.PrinterName = strPrinterName
      End If
      gcrReport.PrintToPrinter(1, False, 0, 0)
Else
      'move on with default settings all on white
      gcrReport.PrintToPrinter(1, False, 0, 0)
End If

Thanks in advance for any help.
YagamanDirector of Information SystemsAsked:
Who is Participating?
 
YagamanDirector of Information SystemsAuthor Commented:
Good Afternoon mlmcc and IdoMillet,

I just wanted to say thank you, but I have exhausted both of your suggestions and I am no further along solving this issue, other than coming to the conclusion that there is no solution to speed up this process on the HP 8150.

Since my code does work fine on the Minolta Bizhub C650 and, although it works on the HP 8150, it is unacceptably slow;  the only conclusion is that the HP 8150 is just not a robust enough printer to handle the switching back and forth of printer drivers.

Now, on the Windows XP OS and using Crystal Reports version 8.5, switching the trays by setting the printer and tray in the actual Crystal Report,  works fine.  However, Crystal version 11.5 (which I am using now) does not have the same feature set up in the same way. This may also be part of the issue. And I am now on Windows 8.1, which also may be part of the problem.

Of course, some more of the fault appears to again lie with SAP Crystal reports and the way in which they are now calling the newer API from the report document object to actually just switch printer trays. This should actually work very nicely since VB.NET does expose methods to be able to do this without switching the actual printer driver.

Oh, well, thanks again to you both for your input, which indeed led me to the final conclusion; and to the further conclusion that I will either have the users use the Minolta Bizhub printer or live with how slow the HP printer is, if they have to go to that one.

Thanks again,
Yagaman
0
 
mlmccCommented:
Is this a multiple page report or are you printing multiple copies of a report?

mlmcc
0
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
One of the 3rd-party Crystal Reports Desktop Schedulers (see list at http://kenhamady.com/productlinks/default.html#desktopsched) provides an API that you can call from your application (or trigger directly via a batch file) to automate the process of exporting a Crystal report to PDF and print the PDF to different paper trays based on invisible Crystal formulas acting as text tags for directing the printout to different trays.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
YagamanDirector of Information SystemsAuthor Commented:
mlmcc,

The reports could be one or more pages; however a complete report first prints in white and then the next report, which is basically the same report only going to a different recipient, prints in yellow.
0
 
YagamanDirector of Information SystemsAuthor Commented:
IdoMillet,

I will be looking at those 3rd party Crystal Reports Desktop Schedulers here shortly. But I was wondering if you had a particular one in mind that you may have used for something like this; or do I need to look at all of them to see if one might work for me?
0
 
mlmccCommented:
The tool he has in mind is Visual Cut.  Since it is his tool he can't self-promote due to EE rules.

mlmcc
0
 
YagamanDirector of Information SystemsAuthor Commented:
mlmcc,

Ah, I see. Okay, I will take a look at that.

However, I will have to check with my manager about spending any money on this project. They are a little apprehensive seeing that I have made it work on both printers, just not fast enough on the HP 8150.

I was wondering if you had any more input on a work around?

Thanks to both you and IdoMillet for your responses.
0
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Your use scenario is simpler than I thought.  I don't think a 3rd-party tool would be a solution to the speed issue.  It's probably something related to report content x printer interaction (scaling to fit?  font support?).

Your first step should be to see what happens if you send the report to the same printer A twice. Same printer B twice.  Is one of them much slower, are both slow? In other words, I don't think it's the printer change that's causing the problem, but this test would confirm/deny that theory.
0
 
YagamanDirector of Information SystemsAuthor Commented:
There is no scaling or font differences between any of these reports just how many pages; and most are one page. Also, I can't send the same report twice in a row from our print program (which is another custom program) because when I pick just one it will ask me to confirm the print after each click of the print button. And for some reason selecting more than one copy doesn't work.

(Forgive me but these are all legacy programs that were built by someone else who is no longer here and I was hired to take over and continue to make things work.)

But your idea is a good one so I went ahead and sent two reports (each printing 2 copies of the reports for the different recipients)  in a row to each printer without alternating the printer drivers and both printers printed at the normal expected speed.

But when I send the same reports so that they will print one copy of each report white and one copy yellow (alternating the printer drivers) those same reports print at the same speed on the Minolta Bizhub as the above test, but on the HP 8150 it was much slower than the above test.

It appears to me that it is the switching of the drivers with the HP 8150. Is it possible that HP is just slow on the re-initializing of the driver and just not as robust of a printer?
0
 
mlmccCommented:
If you are switching the printer driver on the fly, Crystal has to change the driver and regenerate the report using the driver.  That could slow things down.

mlmcc
0
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Good point, mlmcc, though the driver is the same (just 2 logical printer names for the same physical printer with different default tray).  

In any case, if the printer switch causing a report re-rendering is the issue then I suggest you export to PDF and then print the pdf to the 2 printers.
0
 
YagamanDirector of Information SystemsAuthor Commented:
Yes, good point mimcc; so it is the changing of the drivers. I just had not thought of the why, thanks.

And thank you IdoMillet, for the PDF idea. I guess I am disappointed in the HP, since, as I mentioned, my code works so well on the Minolta Bizhub.

Oh, well, I will let you know how the PDF idea works.

Thanks to you both.
0
 
YagamanDirector of Information SystemsAuthor Commented:
Good Morning,

Well, exporting to PDF and then printing did not change anything.

But what I have noticed in all scenarios with the HP 8150 is that every time it prints to the yellow paper tray it is slow; like it has to "think about it" with each print. This happens even when I set the default printer to the HP 8150_Yellow, which has the default tray set to the yellow tray, and then print everything in yellow. It is still pausing after each page, acting like it is still switching to yellow from another tray.

I also noticed in all scenarios, when I am switching back and forth between trays, that it switches from the yellow tray back to the white tray really fast but then when it goes to the yellow it stops and "thinks" again, slowing the process way down.
0
 
YagamanDirector of Information SystemsAuthor Commented:
Because, although the suggestions were good, none of them solved the issue. So I have to go with the code that I had already written.
Thank you.
0
 
YagamanDirector of Information SystemsAuthor Commented:
Hello mlmcc and IdoMillet,

I wanted to come back and let you know that I figured out the problem on the HP 8150 printer of switching back and forth between 2 different paper sources.

The HP 8150 universal printing PCL 6 driver is what HP's website says to use with Windows 8, and works perfectly for normal printing. However, instead of printing the document, it would print out an Invalid Attribute exception when trying to switch drivers. So, I switched to the HP LaserJet 8150 PS class driver, which worked but only at the unacceptably slow speed of 5 seconds when switching to tray 2!

Well, my users could not live with this slower speed, so I continued to research the issue. I finally decided to try the older HP 8150 PCL 5 driver, and, voila, it worked and at normal speeds! It switches trays as fast as if you were printing everything on the same tray!

I should have tried this to begin with even though HP suggested the PCL 6 drivers. Oh, well, praise the Lord, it is now working as it should.

I thought I should come back to post this for anyone else with this problem.

Thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.