Hi,
i have a problem with printing a report. I can't use my printersettings.
Example:
Dim PrnSettings As New System.Drawing.Printing.PrinterSettings
Prnsettings are correct filled from another form with options etc. So everything is fine here.
I set the Settings to Landscape and also to Black and White.
I try to set the Printer settings as follow m_StiReport.Print(false, PrnSettings)
Is there anyway to get Prnsettings to the report ?.
When the report is printed, its still in color and not black and white and also in A4 and not Landscape mode.
As i said, the Prnsettings are correct set.
Any idea ?
Problem with Printing
Problem with Printing
Hello Stephan,
If you want change page orientation you need change it in page settings in report template, because one report template can contain many page templates with different page orientation.
Thank you.
If you want change page orientation you need change it in page settings in report template, because one report template can contain many page templates with different page orientation.
Thank you.
Problem with Printing
Hi Jan,
i now how to change the page settings in the report template. But that's not what i ment.
I need to Change the settings after the user opens the Print Dialog. Choose the orientation and then i want to aply these changes to my report.
There are many settings, like orientation, paper size, color or not etc. These settings are all set in the PrinterDialog form, cause different printers have different
settings, like printing in color or not and so on.
I hope it's now clear what i try to archieve.
Example: Before showing the Report i open this Printer Dialog
Dim PrnD As New System.Windows.Forms.PrintDialog
Dim PS As New System.Drawing.Printing.PrinterSettings
If PrnD.ShowDialog = Windows.Forms.DialogResult.OK Then
' User Sets Color to Black and White if its a Color printer, choose Orientation, Paper mode etc.
PS = PrnD.PrinterSettings
End If
Now i want to Use this "PS" Printer settings in the Report.
Report1.Print(PS) doesnt work. Its still print in color, etc.
Also i want the preview to use the PS Settings. But how can i set Printer Settings to Preview ?.
report.Show() Dont have a Constructor for Printersettings.
Thx
Stephan
i now how to change the page settings in the report template. But that's not what i ment.
I need to Change the settings after the user opens the Print Dialog. Choose the orientation and then i want to aply these changes to my report.
There are many settings, like orientation, paper size, color or not etc. These settings are all set in the PrinterDialog form, cause different printers have different
settings, like printing in color or not and so on.
I hope it's now clear what i try to archieve.
Example: Before showing the Report i open this Printer Dialog
Dim PrnD As New System.Windows.Forms.PrintDialog
Dim PS As New System.Drawing.Printing.PrinterSettings
If PrnD.ShowDialog = Windows.Forms.DialogResult.OK Then
' User Sets Color to Black and White if its a Color printer, choose Orientation, Paper mode etc.
PS = PrnD.PrinterSettings
End If
Now i want to Use this "PS" Printer settings in the Report.
Report1.Print(PS) doesnt work. Its still print in color, etc.
Also i want the preview to use the PS Settings. But how can i set Printer Settings to Preview ?.
report.Show() Dont have a Constructor for Printersettings.
Thx
Stephan
Jan wrote:Hello Stephan,
If you want change page orientation you need change it in page settings in report template, because one report template can contain many page templates with different page orientation.
Thank you.
Problem with Printing
Hello Stephan,
Also you need foreach each component in report to make black and white, but you can do this in rendered report:
Thank you.
You need rerender your report for apply new settings. You need set landscape, papersize and etc. to each page in report template:Stephan1 wrote:Hi Jan,
i now how to change the page settings in the report template. But that's not what i ment.
I need to Change the settings after the user opens the Print Dialog. Choose the orientation and then i want to aply these changes to my report.
Code: Select all
foreach (StiPage page in report.Pages)
{
page.Orientation = newOrientation;
page.PageSize = newPageSize;
}
report.Render();
Code: Select all
foreach (StiPage page in report.RenderedPages)
{
StiComponentsCollection comps = page.GetComponents();
foreach (StiComponent comp in comps)
{
IStiTextBrush textBrush = comp as IStiTextBrush;
if (textBrush != null)
textBrush.TextBrush = new StiSolidBrush(Color.Black);
IStiBrush brush = comp as IStiBrush;
if (brush != null)
brush.Brush = new StiSolidBrush(Color.White);
}
}