На сервере не установлен принтер
I am using PrintToPrinter to print crystal report with page range, It is working fine in my local computer bycause there is printer installed. But when i am deploying that code on server than it is giving a message that Printer is not installed because there is no installed printer on server. But i want to print through clients system I mean i want client side printing in crystal report so it will use client's printer not server printer. Than What should i suppose to do. Any suggestions will be highly appreciable.
Что я уже пробовал:
Dim rpdt As New ReportDocument rpdt.Load(Server.MapPath("rptInvoicetest.rpt")) Dim query As String = "select * from V_INV_GETINVOICERPTPRINT1 where invoiceid='" + ddlInvoiceNo.SelectedValue + "'" Dim dsLoad As New DataSet dsLoad = objService.Exec_Dataset1(query) Dim InvoiceType As String = element dsLoad.Tables(0).Rows(0)("COPY") = InvoiceType rpdt.SetDataSource(dsLoad.Tables("V_INV_GETINVOICERPTPRINT1")) CrystalReportViewer1.ReportSource = rpdt CrystalReportViewer1.DataBind() CrystalReportViewer1.RefreshReport() CrystalReportViewer1.Visible = True rpdt.PrintOptions.PrinterName = GetDefaultPrinter() rpdt.PrintToPrinter(1, False, 1, 1)
Private Function GetDefaultPrinter() As String Dim settings As PrinterSettings = New PrinterSettings() For Each printer As String In PrinterSettings.InstalledPrinters settings.PrinterName = printer If settings.IsDefaultPrinter Then Return printer End If Next Return String.Empty End Function