Question PrintPreviewControl Setting Page Size and Orientation

mrfrisky330

New member
Joined
Oct 16, 2021
Messages
4
Programming Experience
10+
Does anyone know how to do this?

I can set the page size and orientation in the PrintDocument, and PrintDialog prints it correctly, however PrintPreviewControl ignores it!

Have tried setting the page size in the PrintPage event and even messed around flipping the clipbounds height.width to no effect, is it possible to get the PrintPreviewControl to actually use the PrintDocument page settings?

Additional: Also tested with PrintPreviewDialog and that also ignores page settings!
 
Here it is:

C#:
this.PRNTDocument.DefaultPageSettings.Landscape = true;
this.PRNTDocument.DefaultPageSettings.PaperSize = new PaperSize("210 x 297 mm", 800, 800);
this.PRNTDocument.DefaultPageSettings.Margins.Left = 5;
this.PRNTDocument.DefaultPageSettings.Margins.Right = 10;
this.PRNTDocument.DefaultPageSettings.Margins.Top = 20;
this.PRNTDocument.DefaultPageSettings.Margins.Bottom = 20;

if (BLNState)
{
    this.PRNTPrint.Document = this.PRNTDocument;
    //get user options
    this.PRNTPrint.ShowDialog();
    //print using options
    this.PRNTDocument.Print();
}
else
{
    this.PRNTPreview.Document = this.PRNTDocument;
    //preview report
    this.PRNTPreview.Show();
    this.PRNTPreview.Zoom = 0.80;
}

As stated before printing directly works page size and orientation correct but preview ignores the settings??!
 
Last edited by a moderator:
Any particular reason why you are using the PrintPreviewControl? Most people will use the higher level PrintPreviewDialog.
 
You'll need to be more explicit. What page settings is it ignoring? Does is it showing a preview of portrait instead of landscape? Are the margins incorrect?

My quick scan of source code for the PrintPreviewControl and the PreviewPrintController that it uses seems to query the print document for its page settings:
 
Back
Top Bottom