on 10-09-2008 11:45 AM
I've met with a strange situation where my report wont print properly when I use PrintToPrinter from .NET application. But if I export or preview it in the designer it works as expected. When I print, margins set in the reports are lost. How can I make sure PrintToPrinter prints the same way as I export to PDF?
Reports.Sales.Invoice report = new Reports.Sales.Invoice();
foreach (CrystalDecisions.CrystalReports.Engine.Table oTable in report.Database.Tables)
{
DataTable dt = LoadSalesData(SalesId);
oTable.SetDataSource(dt);
}
report.PrintOptions.PrinterName = PrinterName;
PageMargins margins = new PageMargins(288, 3024, 360, 1440);
report.PrintOptions.ApplyPageMargins(margins);
report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
report.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter;
report.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto;
report.PrintToPrinter(1, false, 0, 0);
report.ExportToDisk(ExportFormatType.PortableDocFormat, "Invoice.pdf");
Seems like my large value for top margin(2.2 inches) created this abnormal behavior. I changed the top border to .25 inches and added white space to adjust.
Not sure whether this should be called a bug of Crystal Reports. Anyone met with similar issues?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm terribly stuck with this issue. Anyone got a solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.