Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to print a crystal report with Paper size = Legal & Paper Orientation = Landscape. I want that when the print dialogs opens, it should open with my preferred settings and when printed, it should be printed according to the provided settings. And if possible please help me to show page ranges to print i.e. I want exactly the same work done by the crystal report's default print button.
Posted
Updated 25-Apr-12 8:33am
v2
Comments
Nelek 25-Apr-12 16:30pm    
Nice idea, good luck coding. Since there is no question at all...

For Setting Paper Size
C#
MYCRYSTALREPORT crpt = new MYCRYSTALREPORT();

crpt.SetDataSource(SOMEDATASET);

MYCRYSTALREPORT crpt2 = crpt; //crpt2 will only keep page size

crpt.PrintOptions.PrinterName = "PRINTERNAME";

crpt.PrintOptions.PaperSize = crpt2.PrintOptions.PaperSize;

crpt.PrintToPrinter(1,false,0,0);
 
Share this answer
 
v4
For Setting Margins
VB
Dim oRpt As New rptMyReport()

oRpt.SetDataSource(dsMyDataset)

Dim margins As PageMargins

' Get the PageMargins structure and set the

' margins for the report.

margins = oRpt.PrintOptions.PageMargins

margins.bottomMargin = 0

margins.leftMargin = 0

margins.rightMargin = 0

margins.topMargin = 0

' Apply the page margins.

oRpt.PrintOptions.ApplyPageMargins(margins)

oRpt.PrintOptions.PrinterName = "Epson SQ-1170 ESC/P 2"

oRpt.PrintOptions.PaperSource = PaperSource.Tractor

crSubReportDocument1 = oRpt.OpenSubreport("rptMyReport2.rpt")

crSubReportDocument1.SetDataSource(dsMyDataset2)

crSubReportDocument1.PrintOptions.ApplyPageMargins(margins)

CrystalReportViewer1.ReportSource = oRpt

CrystalReportViewer1.Zoom(65)
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900