how to set printername for Reportviewer from code (VS2005)?

G

Guest

Hello,

I need to print a report from the VS2005 Reportviewer control. My problem
is that I need to print to a tractor feed (dotmatix like) printer that is not
the default printer - for printing mailing labels (thousands of them). I can
set all the settings from the pagelayout button of the Reportviewer at
runtime, but that is a real hassel - set the margins, paper orientation,
papersize, printername. I tried using a deviceInfo type string like this:

// Build device info based on start page
deviceInfo = String.Format(
"<DeviceInfo>" +
"<OutputFormat>EMF</OutputFormat>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
" <StartPage>{0}</StartPage>" +
"</DeviceInfo>", pageIndex+1);

but this uses streams for rendering which would require more coding than I
want. How can I set the page layout/printer/paper properties from code for
the Report viewer? How to do it the lazy/limited braincells way? I tried

PageSetupDialog ps1;
ps1 = New PageSetupDialog;
ps1.PrinterSettings.PrinterName = "\\NASPP14\T6045";

but VS complained, besides how to I assign it to my RptViewer object? Or do
I need to go the deviceInfo/streams route?

Thanks,
Rich
 
C

chanmm

Install the same driver as another printer with a different printer name
then print though that printer name.

chanmm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top