on 03-06-2022 12:21 PM
I am trying to print a crystal report by sending report to printer directly with the help of a webservice .However i get Load Report error.This was a working code in wpf application .I just took the printing part of the code to a web service so that i dont have to install printer in every client PC as I have about 300 users.I have given full access to read/write for the folder to Everyone,Local Service,Network Service.Web service is asmx ,soap based .My code is below
<WebMethod()> _
Public Function PreDeliveryDocument(ByVal ldtDetails As DataTable, ByVal lsPrinterName As String, ByVal lsDocType As String) As String
Dim ObjDoc As New ReportDocument()
ObjDoc.Load("//Server Name//Crystal_Reports//VHRSSALEPDU001.rpt")//shared location code working in WPF App
'ObjDoc.Load("D:\\Crystal_Reports\\VHRSSALEPDU001.rpt")//Tried this but same error
'ObjDoc.Load("D://Crystal_Reports//VHRSSALEPDU001.rpt")//Tried this but same error<br>
ObjDoc.SetDataSource(ldtDetails)
ObjDoc.PrintOptions.PrinterDuplex = PrinterDuplex.Default
If CheckifPrinterInstalled(lsPrinterName.ToString().Trim()) = True Then
'ObjDoc.PrintOptions.PrinterName = row.Cells(9).Text.ToString().Trim()
ObjDoc.PrintOptions.PrinterName = lsPrinterName.ToString().Trim()
ObjDoc.PrintToPrinter(1, False, 0, 0)
ObjDoc.Dispose()
Return "Pre Delivery Document " & lsDocType.ToString().Trim() & " has been sent to printer " & lsPrinterName.ToString().Trim() & " \r\n"
Else
Return "This printer " & lsPrinterName.ToString().Trim() & " is not installed on server,cannot print"
End If
End Function
Sounds like a permission issue.
If you map the Drive does that work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.