Printing landscape

  • Thread starter Thread starter Nicholas Paldino [.NET/C# MVP]
  • Start date Start date
N

Nicholas Paldino [.NET/C# MVP]

Instead of setting the PageSetting in the PrintPage event, have you
tried setting the Landscape property to true on the PageSettings instance
returned by the call to the DefaultPageSetting property on the PrintDocument
class?

Hope this helps.
 
I am apparently unable to print landscape... maybe I'm doing something
wrong here.

I am adding a printDocument to a form. The form also has a textbox
containing the text that I want to print and a button that triggers the
printing. All properties of all objects are left intact for simplicity's
sake.

Code on the form:

private void button1_Click(object sender, EventArgs e) {
printDocument1.Print();
}

private void printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e) {
e.PageSettings.Landscape = true;

e.Graphics.DrawString(textBox1.Text, new Font("Arial", 12,
FontStyle.Bold), Brushes.Black, 20, 20);
}


I am trying this with three different printers here in the office and it
still prints portrait. What am i doing wrong?


Dragos.
 
Nicholas said:
Instead of setting the PageSetting in the PrintPage event, have you
tried setting the Landscape property to true on the PageSettings instance
returned by the call to the DefaultPageSetting property on the PrintDocument
class?

Hope this helps.
Thank you. It worked perfectly.


Dragos
 

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

Back
Top