cancel
Showing results for 
Search instead for 
Did you mean: 

PrintToPrinter HELP

Former Member
0 Kudos

Hi all, i have created new form and button1, on Button1 click i would like print directly my report.

This is the code:

Dim rptDocment As New CrystalDecisions.CrystalReports.Engine.ReportDocument

rptDocment.Load("C:\a.rpt")

Dim aPrintDialog As New PrintDialog()

If aPrintDialog.ShowDialog = DialogResult.OK Then
	With aPrintDialog.PrinterSettings
		rptDocment.PrintOptions.PrinterName = .PrinterName

		rptDocment.PrintToPrinter(.Copies, .Collate, .FromPage, .ToPage)
	End With
End If

But there is a problem: when PrintDialog show, i click on Properties of print, and i set 2 page for paper. After confirm the properties, i confirm the printdialog...... but when the paper exits on the printer there are 1 page per paper!!!!!!!!!!

Thanks for Help

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Export your report to RPT format and then print from the Report Designer as a test. If you get the same results it's likely due to having the New Page after option checked on in one of your sections.

Thank you

Don

Former Member
0 Kudos

The report "a.rpt" (see code above) is a test report that have 2 section with the flag "New Page after"

When print dialog show, i can open the print properties. In that form i set "print in economy mode" or "black and white" but when i confirm and routine execute "PrintToPrinter" function, the paper Printed are normal (not economy or not in black and white)

If i use a crystal report viewer, and i click on print button, in print properties i set "black and white", and the paper Printed are OK (black and whte)

Thanks

0 Kudos

Great info. So what is happening if you set some of the options it uses the default other options.

Now you need to set the color and other options in code also. If you don't see them then you'll need to either use RAS and PrintOutputController or create a new printer with those options set as default and select that printer in code.

If you need more info then we need to know what version of VS and CR you are using?

Don

Former Member
0 Kudos

What do you mean by PrintOutputController ?

I'm using Visual Studio 2008 with Crystal Report 2008 (Full Edition)

Thanks for your helping

Matteo

0 Kudos

It's part of RAS.

See these samples for more info on how to:

Exporting Samples (RAS)

http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples#NETRASSDKSamples-Exporting%2FPrinting

Or search here also, lots of sample code on how to.

Don

Answers (0)