Skip to Content
0

Printing a CR w/ VS 2015 Windows Service is printing many copies when it should only print 1 page

Apr 26, 2017 at 04:33 PM

46

avatar image
Former Member

Hello,

I have a crystal report template that is populated with data in a windows service. When the service sends the job to the printer, the printer queues up the job as having many pages. In the printer queue I'm seeing that for one report it's printing 54 pages when it should only print a single page. The report is landscape.

Is there a specific setting that I need to apply in the code to force that only a single page gets printed?

I've been looking at the code in the RAS2010_Printing application that Don Williams wrote but I'm not seeing any obvious solutions to this particular problem.

Thank you,

Michael Helduser

10 |10000 characters needed characters left characters exceeded
Former Member

This only happens with one of my reports that I'm printing in landscape page orientation. The other report template is printing fine.

I have one template that appears to be doing this. It repeats the same page and prints that same page and same data either 48 or 54 times. I know that from looking at the print job queue for the printer. What might be causing the report to generate all of those copies. It's only one print job but 48 or 54 pages of copies of the same single page report.

Any ideas on what might cause something like this?

This report like the other that prints correctly was created in CR Version 10.

Thank you,

Michael Helduser

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Don Williams
Apr 27, 2017 at 09:46 PM
0

Hi Michael,

I have another app that has the printer plus ability to set log on info:

https://blogs.sap.com/2016/02/17/how-to-parameters-in-crystal-reports-for-visual-studio-net/

You can test it in that app. Run in debug mode because it is looking to set parameter values so you can comment out those lines.

So the reports do not have saved data, that is why it's prompting...

Don

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you Don. I'll take a look.

0
Don Williams
Apr 26, 2017 at 08:27 PM
0

Wow... that's a new one... Never heard of that before...

When you say Windows Service is it the basic winspooler service or some third party print manager?

If you send out a 2 page report how many pages get printed?

Are you using a real printer or using a Remote Session and the (Redirected 2 ) drivers?

CR requires the printer to be available and installed on the local PC when printing.

Don

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

assy-ipfunction-test-my17.pngHi Don,

Thank you for getting back to me.

It's a custom print service created in VB.Net in VS 2015 Enterprise.

This report has 53 sub-reports inside of it. Each subreport is small and represents a single part each.

I was reading this case last night where it is blaming the subreport for the multiple copies:

http://www.dotnetfunda.com/forums/show/3588/crystal-report-multiple-copies-of-single-report-page

I'm still not sure exactly how this should be fixed. I'll attach the rpt file so you can see what the report looks like.

The printer(s) that it can print to have all been added as printers on the server that the print service is running on.

When the print job is created with the PrintToPrinter(printerSettings, pSettings, false, PrintLayout) method.

I've even tried to adjust all of the parameters I could to make sure only 1 page would be printed and the printer queue still ends up showing the report job as 48 to 54 pages in size.

This doesn't happen to other rpt files that have subreports.

Here's the report that produces all of the pages:

Assy_IPFunction_Test MY17.rpt --> this is the report template that prints multiple copies of the same page instead of printing just 1 page.

JobManifest1.rpt --> this has 3 subreports but consistently prints as expected with just a single page.

I've also included PrintThread.vb --> that shows the differences in the settings I'm using when I print the report for the "Assy" manifest type. I may tried to just leave all the settings as they were for the non "Assy" manifest type to see if that will work. I'll update this posting if it has any effect.

See the SubmitReport() method --> that is where I set all of the crystal settings, LoadReport() is also in the same file.

I was wondering do any of the assignments to Report.PrintOptions work? Or do all of them now have to be done through printerSettings and pSettings, are they overriding whatever is set in Report.PrintOptions?

Just curious because I know the

Report.PrintOptions.PrinterName = printerSettings.PrinterName.ToString()

has no effect and the PrinterName remains an empty string.

I was able to upload the file PrintThread.vb as PrintThread.txt.

Since I can't upload rpt files to this link you can access them here in my hightail fileshare location:

https://spaces.hightail.com/receive/Yfa9kqTgtT

If you can't access it I'll need an email address to give you access to hightail.

I did insert the report that I'm having the issues with as a picture so you can see it's layout.

Thank you for all your help,

Michael Helduser

0

That is odd, the reports say they have saved data, it's checked on, but I don't get any data so I can't preview them.

Can you try using ProntOutputController ( POC ) in my test app.

Open the report with saved data, select the printer from the drop downlist on the left, Click the Set Printer button and then click the POC button to print it.

Next is to enable the POC from the viewer, click on the check box to select it and then preview and then print.

What happens?

P2P is a basic API and may not allow you to save/use an custom settings.

It could be it's printing portrait and because it's formatted for landscape it extends the pages until all data i sprinted.

And modify the report, uncheck No Printer and select the the Service and then check the dissociate option on.

What CR for VS does is it queries the printer driver and dynamically uses various properties for that printer. It may be simply CR doesn't know what to do using your Service. The logic is if we can't find the printer driver we use the default properties.

Try exporting the report to RPT format, that should save data with the report.

Don

0
Former Member

It's on CR Version 10 so I need to get access to that designer. I just spoke with SAP support and they don't have the old installers for that version. I suppose I could try to see if I can fix the issue in the designer for CR 2016. I'm seeing if the customer can find the old CR Version 10 installer.

I unchecked the No Printer checkbox and attempted to click the SetPrinter button and it made the printer the printer that I'm trying to print to on the server.

I then tried the POController button and it errors out that it can't connect to the database. I think it's trying to connect to the database that was used when the report was initially created. I'll need to get into the report template and repoint it to the correct server and database for this test to work.

What is the oldest version of Crystal that is available for download and install? I realize version 10 isn't available for download but what would be the next version up from that which would be available to install?

Thanks,

Mike

0