cancel
Showing results for 
Search instead for 
Did you mean: 

Load Report Failed-when trying to print crystal report with web service

0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Sounds like a permission issue.

If you map the Drive does that work?

Answers (0)