Hi, I develope my intranet with ASP.Net [VB.Net] and I must print some report directly on the printer installed on client pc...
I use method PrintToPrinter, the print is ok if i debug the application, but after publish the site the print make a error....
Why??? Sorry, I understand the web page run on server and it don't see client printer default, so i use a function:
Private Sub PrintReport(ByVal printerName As String)
Dim margins As PageMargins
' Get the PageMargins structure and set the
' margins for the report.
margins = rpt.PrintOptions.PageMargins
margins.bottomMargin = 350
margins.leftMargin = 350
margins.rightMargin = 350
margins.topMargin = 350
' Apply the page margins.
rpt.PrintOptions.ApplyPageMargins(margins)
' Select the printer.
rpt.PrintOptions.PrinterName = printerName
' Print the report. Set the startPageN and endPageN
' parameters to 0 to print all pages.
rpt.PrintToPrinter(1, False, 0, 0)
End Sub
the call is
Dim prtdoc As New PrintDocument
Dim strDefaultPrinter As String = prtdoc.PrinterSettings.PrinterName
PrintReport(strDefaultPrinter)
The error persist.....
Help me.... please