I am trying to print custom paper size (8.5in Wt. x 5.5in Ht.)
My Printer does not allow to create custom paper size when Width greater than Height. So I decided to do it dynamically through c#. Here are the steps I have done.
Step1:- Created a custom paper size from Print Server Properties under Devices And Printers and named it JVD
Step2:- My C# Code
- using (DataSet Ds = GetPrintDetails(Dt, Con))
- {
- HospDataSet.Tables["ME_ProductSale"].Merge(Ds.Tables[0]);
- HospDataSet.Tables["ME_ProductSale_Detail"].Merge(Ds.Tables[1]);
- HospDataSet.Tables["ME_Identity"].Merge(Ds.Tables[2]);
- ReportPath = Environment.CurrentDirectory + "\\Reports_ME\\rptProductSale.rpt";
- rptDoc.Load(ReportPath);
- rptDoc.SetDataSource(HospDataSet);
- PrintDocument PD = new PrintDocument();
- for (int i = 0; i <= PD.PrinterSettings.PaperSizes.Count - 1; i++)
- {
- if (PD.PrinterSettings.PaperSizes[i].PaperName == "JVD")
- {
- rptDoc.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)PD.PrinterSettings.PaperSizes[i].RawKind;
- break;
- }
- }
- rpvHospitalReportViewer.ReportSource = rptDoc;
- rpvHospitalReportViewer.Refresh();
- }
But still not able to print custom paper size. What I am doing wrong?
Any help will be appreciable.