Crystal 在客户机上打印来自服务器的文档时报告获取-传递给系统调用的数据区太小错误

Crystal report when printing document from server on client machine getting-The data area passed to a system call is too small error

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

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

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