cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CrystalReportViewer selects wrong printer using PrintOuputController dialog

allan11
Explorer
0 Likes
2,221

My client has 2 EPSON LQ-310 printers named A and B installed on computer and reports are set to print on either printer which decided at runtime. Everything works fine if application directly print to printers using RAS API. However, when client first preview the report using CrystalReportViewer control and click print button, the printer select dialog will not set to desired printer A and always selects printer B.

I am using CRforVS SP32 SDK. Print mode of CrystalReportViewer control is set to PrintOutputController and saved printer in report is set to printer A. Report generation is followed to sample app RAS2010_printing.

I had looked through many Q&A and can't solve the problem. Please help.

Accepted Solutions (1)

Accepted Solutions (1)

0 Likes

Hi Allan,

R&D suspects it the "/" in the name causing the issue. I renamed my printers and replaced the / with a space and now direct printing using POC is working, it selects the new printer I select in form for the output.

The only limitation is setting the Viewer Print Button to use POC, it still defaults to the first or last printer in the list.

This is I believe by design, P2P does select the printer selected so it could be partially my code causing the problem. Setting the Viewer to use the RAS Object may be the cause, I ran out of time to do more testing.

Don

Answers (20)

Answers (20)

allan11
Explorer
0 Likes

OK... thanks for your help.

And I would like to ask will this problem be fixed in the future?

0 Likes

Correct, Using your own print button would be the way to go.

Lot's of embedded work flows and functions embedded in CR Designer that you need to emulate in your app, that is expected behaviour.

allan11
Explorer
0 Likes

So the only workaround is to create a direct POC print button instead of Viewer Print button? I tried open the report in Crystal Report 2013 application and it selects correct printer while previewing the report. Whats the difference between the application and CRforVS sdk?

allan11
Explorer
0 Likes

Yes I tried both options in Viewer properties, same result obtained.

0 Likes

So did you check on the POC before viewing the report and not you can change it in the Viewer properties also:

If I check on POC and then view report I don't get the error but it's not taking the new printer.

It's likely a coding issue in my logic, if you use the POController button it does use the selected printer.

I'll have to do some testing on monday or when I get some time to check my code. It appears it's using the default printer saved in the report and not using th new printer selected in code...

And you are correct, sorry about that, using P2P does appear to use the selected printer.

Don

allan11
Explorer
0 Likes

P2P method is working for me, but I need to use POC to print. Did you got same result under POC?

0 Likes

I used the same one attached to the KBA and here's what it looks like after changing the printer, checking on Dissociate and saving it:

And using the Viewers Print button:

0 Likes

I tried also and it's still working for me.

There's been other post about fonts, Same font name but different versions, same byte compare, one worked and one did not.... very strange.

Try a different font, possibly there's a new virus or trojan running around embedded in font files...

Try a different font or set your PC to English and see it changes anything.

allan11
Explorer
0 Likes

That's strange because I got the same problem on all client PCs and my own developing PC. Maybe this problem occurs when PC uses Chinese platform?

I got the sample app from this kb (https://userapps.support.sap.com/sap/support/knowledge/en/2163438). Is this the most updated app?

0 Likes

Hi Allan,

I'm not seeing the problem, I can select either from the Viewer or set it in code.

I believe this is a platform issue or possibly permissions, I can't duplicate it so it has to be something on your PC causing the problem.

The Viewer will select whatever printer is saved in the Report.

Don

allan11
Explorer
0 Likes

I followed your instruction and reinstalled 2 printers, installing latest driver and create a new report. This time the printer not found message is gone but still selects printer B by default.

I attached the sample report, thank you for your help.

sample2zip.txt

0 Likes

Hi Allan,

Interesting, I don't see what you see.

Only thing I can suggest is try reinstalling the printer and recreate the 2 printers. I downloaded the 64 bit version from their website and installed the same printer as you are using on my Windows 10 PC.

Can you create a new report with just a "Hello World" in a text object and test to see if you get the same behaviour?

If you do then zip the report file and then add a .txt extension to the file and attach it to the post and I'll test your report.

Don

allan11
Explorer
0 Likes

Yes it works when selecting Printer B and save the RPT, but not vice versa. I can see saved printer name updated when selecting Printer A and save RPT, but still selects Printer B using Viewers Print button with showing Printer A not found.

Saved Printer Name already updated

0 Likes

I'm not see it... Report using that printer saved in the RPT file

Then Selected B and set Printer button and saved the report

As you can see the Saved Printer name was updated.

Reminder also, using the Viewers Print button WILL ALWAYS use the Default printer or the printer saved in the RPT file when designed. Even if you select a different printer.

allan11
Explorer
0 Likes

I am using my own developing machine to reproduce the problem, the screen captures are taken from my PC. All two printers are installed and I saved the printer name in rpt but still got printer not found result when using POC. Direct print from crystal report application shows correct printer.

This problem only exists when two printers are using same printer driver.

0 Likes

In the Print dialog box you'll see 2 properties, one is the Saved Printer name and the other is the Saved Paper size.

If the Printer is not installed then you will get the Save Printer not found message.

Install the printer on the WEB server, then it should work.

Same for your PC, install the printer, same name as in the dialog box in CR when selecting the printer.

allan11
Explorer
0 Likes

Yes I can print to the desired printer when creating my own print button.

But why POC showed saved printer not found when using print button in Viewer? I tired your suggested step to save the printer in the RPT file but still got same result. So the only workaround is to create my own print button instead of using print button in Viewer?

0 Likes

POC uses what ever printer you select in the Dialog and in code.

P2P uses what is saved in the Report, so if it's not saved it uses the users default printer and it's not adjustable.

Use POC when selecting a new printer.

You can also save the printer in the RPT file, Click on the Print button in CR Designer, select the printer and then save it/Update, don't print the report.

Use that new report and the Viewers print button will use the info saved in the rpt file.

You could like my test app create your own custom print button...

allan11
Explorer
0 Likes

Yes I had tried and got same result

Report page setup

Sample app always choose printer B

Two printers A and B are using same printer driver. When I tried set printer B using another printer driver such as Microsoft XPS Document Writer, PrintOutputController dialog can select correct printer (Printer A). I am wondering does PrintOutputController dialog selects printer by identifying saved printer driver name rather than saved printer name? Therefore the dialog selects first printer that uses saved printer driver name from the installed printer list?

0 Likes

See if my test app work for you:

Printing Crystal Reports in .NET

Open the report with saved data, select the printer from the drop down list and the set printer button.