1
votes

I need to print a RDLC report on the default printer on user (client) machine.

I have an VB.Net (VS 2008/.Net 3.5) web app that has RDLC reports. Part of the requirement is to NOT show the user the report generated but to print it directly on the user default printer. The user would click on a button and the respective report should be sent to the user printer.

Any ideas or suggestions would be greatly helpful.

Update - So far all my attempts to build client side printing for rdlc reports have failed. Could not print them from client default printer, only server side printing works

1
It would be helpful to know (for people that have this question in the future) what options you have investigated and why they didn't work. Feel free to edit the question to add this information when you can.Jeff B
Update - So far all my attempts to build client side printing for rdlc reports have failed. Could not print them from client default printer, only server side printing worksBCV

1 Answers

1
votes
I have a solution for the rdlc printing directly without preview.
1. Convert the local report to word.
2. print the word document. You can pop up the print diaglog and let you choose the printer.
sample code like:

'Convert to word:
Dim bytes As Byte() = rptForm.ReportViewer1.LocalReport.Render("WORD", Nothing, mimeType, encoding, extension, streamids, warnings)

 Dim printDlg As New PrintDialog()
 Dim PrinterName as String
 If (printDlg.ShowDialog() = DialogResult.OK) Then
     PrinterName = printDlg.PrinterSettings.PrinterName
 End If

'Print the word document:
Dim appWord As New Word.Application
 appWord.Documents.Open(FullPath, m, m, m, m, m, m, m, m, m, m, m)
 appWord.WordBasic.FilePrintSetup(Printer:=PrinterName , DoNotSetAsSysDefault:=1)
 appWord.ActiveDocument.PageSetup.Orientation = WdOrientation.wdOrientPortrait
 appWord.ActiveDocument.PageSetup.PaperSize = WdPaperSize.wdPaperLetter
                    appWord.ActiveDocument.PrintOut()
                    appWord.Documents.Close()
                    appWord.Quit()
                    appWord = Nothing