Home > Net >  Crystal reports PrintToPrinter times wrong pushed to the printer
Crystal reports PrintToPrinter times wrong pushed to the printer

Time:03-31

String filePath=AppDomain. CurrentDomain. BaseDirectory + fileName;
String toFilePath=AppDomain. CurrentDomain. BaseDirectory + toFileName;
Using (CrystalDecisions CrystalReports. Engine. ReportDocument rd=
New CrystalDecisions. CrystalReports. Engine. ReportDocument ())
{
Rd., the Load (filePath);
Try
{
Rd., SetDataSource (dataSource);

PrinterSettings PrinterSettings=new PrinterSettings ();
PrinterSettings. PrinterName=PrinterName;//"
PrinterSettings. PrintFileName=fileName;

PageSettings PageSettings=new PageSettings ();

Rd. PrintToPrinter (printerSettings pageSettings, false);

CrystalDecisions. Shared. ExportOptions exportOpts=new CrystalDecisions. Shared. ExportOptions ();
CrystalDecisions. Shared. DiskFileDestinationOptions diskOpts=
CrystalDecisions. Shared. ExportOptions. CreateDiskFileDestinationOptions ();

ExportOpts. ExportFormatType=CrystalDecisions. Shared. ExportFormatType. PortableDocFormat;
ExportOpts. ExportDestinationType=CrystalDecisions. Shared. ExportDestinationType. DiskFile;
DiskOpts. DiskFileName=toFilePath;
ExportOpts. ExportDestinationOptions=diskOpts;
Rd. Export (exportOpts);
}
The catch (Exception ex)
{
WriteLog. ExLog (MethodBase. GetCurrentMethod (). The Name, the ex. Message);
}
The finally
{
Rd. The Close ();

Rd. The Dispose ();

}
}
Data is no problem, print zhang's case will be submitted to the exception, GDI general error

CodePudding user response:

Their top, can you help solve please bosses drink cappuccino
  •  Tags:  
  • C#
  • Related