I have a VB.NET application and I use crystal reports in it to send a report file directly to printer to print a document .When I run the application locally in development machine it works ,but when I run it after it is deployed in server and I print document ,I get "The data area passed to a system call is too small" error .Below is my code related to printing
Dim ObjDoc As New ReportDocument()
lsOrgDup = "D"
cocPrinting.FetchReportDataforUTDoc1(row.Cells(4).Text.ToString().Trim(), row.Cells(5).Text.ToString().Trim(), row.Cells(6).Text.ToString().Trim(), row.Cells(3).Text.ToString().Trim(), row.Cells(2).Text.ToString().Trim(), row.Cells(7).Text.ToString().Trim(), lsOrgDup, cdtUTDoc01, lsErr)
ObjDoc.Load("Crystal_Reports//VHRSSALEPDU001.rpt")
ObjDoc.SetDataSource(cdtUTDoc01)
If cEnvironment.Production = psEnvironment Then
If CheckifPrinterInstalled(row.Cells(9).Text.ToString().Trim()) = True Then
ObjDoc.PrintOptions.PrinterName = row.Cells(9).Text.ToString().Trim()
ObjDoc.PrintToPrinter(1, False, 0, 1)
lsPrintMessage = lsPrintMessage & "Pre Delivery Document has been sent to printer" & " \r\n"
Else
lsPrintMessage = "This printer " & row.Cells(9).Text.ToString().Trim() & " is not installed for this PC,cannot print"
End If
End If
With below code i am able to download the document to clients PC ,but issue comes when i try to print it
If cEnvironment.Development = psEnvironment Then
Dim formatType As ExportFormatType = ExportFormatType.NoFormat
formatType = ExportFormatType.PortableDocFormat
ObjDoc.ExportToHttpResponse(formatType, Response, True, "Undertaking Doc")
Response.End()
End If