Click here to Skip to main content
14,545,667 members
Rate this:
Please Sign up or sign in to vote.
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...
Rate this:
Please Sign up or sign in to vote.

Solution 1

For Setting Paper Size
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);
   
v4
Rate this:
Please Sign up or sign in to vote.

Solution 2

For Setting Margins
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)
   
v3

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100