Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

print crystal report to non default printer

Posted on 2013-12-21
4
Medium Priority
?
1,409 Views
Last Modified: 2013-12-23
Hi Experts
I would like to print my crystal report to non default printer on my machine.
I have tried the following codes
    CrystalReportViewer1.ReportSource = mrptDoc
        mrptDoc.PrintOptions.PrinterName = printer_selected

      CrystalReportViewer1.PrintReport()

Open in new window


printer_selected is non default printer, but it still prints to default printer.

Thanks
0
Comment
Question by:b001
  • 2
4 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 39735323
Can you set the printer for the viewer?

Try using the print method on the report object

mrptDoc.PrintToPrinter(1, false, 0, 0);

Public Overridable Sub PrintToPrinter(ByVal nCopies As Integer, ByVal collated As Boolean, ByVal startPageN As Integer, ByVal endPageN As Integer)


Parameters
nCopiesIndicates the number of copies to print.

collatedIndicates whether to collate the pages.

startPageNIndicates the first page to print.

endPageNIndicates the last page to print.

Remarks

To print all pages, set the startPageN and endPageN parameters to zero.

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 39735348
Added Crystal Reports topic

mlmcc
TA
0
 

Author Comment

by:b001
ID: 39735581
hi
still selects default printer.

when execute the following line
 CrystalReportViewer1.PrintReport()


it opens the Print Dialog and it has default printer selected.

Thanks
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question