Landscape printing by default in Crystal Report

jelo

Member
Joined
Jan 23, 2006
Messages
23
Programming Experience
Beginner
Hello,

I am publishin a report developed in Crystal Reports usin the Crystal Report Viewer. Now I would like that when ever user clicks the Print Icon present as a default printin option on the Crystal Report Viewer the report must print out as a landscape by default. I have accomplished this thin when i print the Windows form by specifyin the landsacpe as default value for the QueryPageSettingEventArgs but I want to implement the default landscape functionality when I print the reports.

Any help is highly appreciated
 
The command to use is:

CrystalReportViewer1.ReportSource = rpt
rpt.PrintOptions.PaperOrientation = CrystalDecisions.[Shared].PaperOrientation.Landscape
CrystalReportViewer1.Zoom(1)
CrystalReportViewer1.Refresh()


In the report viewer form load event.
 
Thanks for ur reply.

I have tried the method u provided but m still gettin the print out in the form of a portrait.

Please Advice
 
Let's see your code.
Was the report designed in landscape?
Right click on report, DESIGNER, PRINTER SETUP is it set to landscape?
 
Thanks Buddy,

But it is exactly landscape in the Report Settings.

Please Advice one again.

Waitin for ur reply
 
After thinking about it I came up with this:

The print button on the viewer is picking up the default printer layout from the printer selected. Someone else might have a way to override the PrintReport function and specify landscape there. For now it will be up to the user to specify the layout for the selected printer under printer properties if they use the print button. Or change the default page layout to landscape through Windows for that printer (not my choice).
Your other option is to take away the print button and create your own on the form.

Add a print button and print dialog to the form the report viewer is on and add the code to print there: You could then set the display print button to false for the viewer.

On the button click:

VB.NET:
PrintDialog1.Document = New System.Drawing.Printing.PrintDocument
PrintDialog1.AllowSelection = True
PrintDialog1.AllowSomePages = True
Dim rpt As New CrystalReport1
If PrintDialog1.ShowDialog() = DialogResult.OK Then
    rpt.PrintOptions.PrinterName = PrintDialog1.PrinterSettings.PrinterName
    rpt.PrintOptions.PaperOrientation = CrystalDecisions.[Shared].PaperOrientation.Landscape
    rpt.PrintToPrinter(PrintDialog1.PrinterSettings.Copies, True, PrintDialog1.PrinterSettings.FromPage, PrintDialog1.PrinterSettings.ToPage)
End If
 
Thanks,

I will try this out n will let u know accordingly if i need some further assistance.

Thanks a lot once again

Wishes
 
Back
Top