Yesterday urgently I wanted to write a code to set a crystal reports page size into a custom page size. I checked every where but there were very little code to be found. Finally I managed to do it from the following code.
System.Drawing.Printing.PrintDocument doctoprint = new System.Drawing.Printing.PrintDocument();
doctoprint.PrinterSettings.PrinterName = "Microsoft XPS Document Writer";
for (int i = 0; i < papername ="="" the="" custom="" page="" name="">)
{
rawKind =
Convert.ToInt32(
doctoprint.PrinterSettings.PaperSizes[i].GetType().GetField("kind",
System.Reflection.
BindingFlags.NonPublic |
System.Reflection.
BindingFlags.Instance).
GetValue(doctoprint.PrinterSettings.PaperSizes[i]));
//crPrintOut.PrintOptions.PaperSize = rawKind;
_report.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize) rawKind;
break;
}
}
It is very nice. Thanks for share..........
ReplyDeleteCrystal Custom
nice blog. I like this very much
ReplyDeleteCrystal Custom
Thank you Dharmendro Bhuyan..
Deletei'll try.. thankyou for sharing :D
ReplyDelete