【问题标题】:Crystal report when printing document from server on client machine getting-The data area passed to a system call is too small error水晶报表在客户端机器上从服务器打印文档时得到-传递给系统调用的数据区域太小错误
【发布时间】:2021-08-12 07:10:22
【问题描述】:

我有一个 VB.NET 应用程序,我在其中使用水晶报表将报表文件直接发送到打印机以打印文档。当我在开发机器上本地运行应用程序时它可以工作,但是当我运行它之后部署在服务器中,我打印文档,我得到“传递给系统调用的数据区域太小”错误。下面是我与打印相关的代码

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

使用以下代码,我可以将文档下载到客户端 PC,但是当我尝试打印时出现问题

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

【问题讨论】:

  • 我找到了导致问题的行“ObjDoc.PrintOptions.PrinterName = row.Cells(9).Text.ToString().Trim()”,如果我们设置打印机名称上述错误发生

标签: vb.net printing crystal-reports


【解决方案1】:

问题是打印机名称的长度,之前它很长,例如:“HP Laser Jet M400 PCL 6”,我将打印机设置中的打印机名称减少为“VHGPrinter”并且正在打印水晶报告

【讨论】:

    猜你喜欢
    • 2023-03-20
    • 1970-01-01
    • 2012-10-22
    • 2022-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多