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
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