Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, everyone.
I'm facing 2 problem when print crystal report from vb.net 2010.
Problem 1: Printer will feed extra paper before printing.
Problem 2: The crystal report is printed in a very small size.

CR Runtime = version 13.0.2000.0
Printer Model = Thermal Printer

My sample code:
Private _ReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
_ReportDocument.Load("C:\Report\Testing.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault)
_ReportDocument.SetDatabaseLogon(DbUserId, DbPassword)

Dim DefPrintReportOptions as New CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions
Dim zPrinterName as string = "ThermalPrinter"
Dim tmpPrintDoc As New System.Drawing.Printing.PrintDocument()
tmpPrintDoc.PrinterSettings.PrinterName = zPrinterName

DefPrintReportOptions.PrinterName = zPrinterName
DefPrintReportOptions.PaperSize = tmpPrintDoc.DefaultPageSettings.PaperSize
DefPrintReportOptions.PaperSource = tmpPrintDoc.DefaultPageSettings.PaperSource
_ReportDocument.ReportClientDocument.PrintOutputController.PrintReport(DefPrintReportOptions)


I don't use _ReportDocument.PrintToPrinter(1, False, 0, 0) to print report because it take too long time to print out the crystal report.

Your help is very appreciated.

What I have tried:

My sample code:
Private _ReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
_ReportDocument.Load("C:\Report\Testing.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault)
_ReportDocument.SetDatabaseLogon(DbUserId, DbPassword)

Dim DefPrintReportOptions as New CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions
Dim zPrinterName as string = "ThermalPrinter"
Dim tmpPrintDoc As New System.Drawing.Printing.PrintDocument()
tmpPrintDoc.PrinterSettings.PrinterName = zPrinterName

DefPrintReportOptions.PrinterName = zPrinterName
DefPrintReportOptions.PaperSize = tmpPrintDoc.DefaultPageSettings.PaperSize
DefPrintReportOptions.PaperSource = tmpPrintDoc.DefaultPageSettings.PaperSource
_ReportDocument.ReportClientDocument.PrintOutputController.PrintReport(DefPrintReportOptions)
Posted

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900