473,320 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Printing landscape

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.
Mar 28 '07 #1
2 8394
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"FireStarter" <d@d.comwrote in message
news:eJ**************@TK2MSFTNGP02.phx.gbl...
>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.

Mar 28 '07 #2
Nicholas Paldino [.NET/C# MVP] wrote:
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
Mar 28 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Darcy Kahle | last post by:
I am trying to do some advanced printing in python using the win32ui module, and have run into an issue. I need to print a page landscape. As I could not determine how to specify the orientation...
4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
3
by: MarcJ | last post by:
Hello, I can't seem to get printing to landscape working. Here is some of the code I've tried. '--------------------------------------------------------------------------------- Dim...
2
by: viki | last post by:
Hi, i want my html pages to be printed in landscape format. I think it can be done with css. I tried some but it doesn't help. can anybody help me with the code. Thanks,
4
by: Eric | last post by:
We have a customer requirement that the final paperwork from an ASP.net application is formatted and printed Landscape. What is the best way to achieve this? What are my options? Thanks
3
by: D Witherspoon | last post by:
No matter what I do the default paper size is always either A3 or 11 by 8.5 .. Here is the code. Dim dlg As DialogResult pd.DocumentName = "Weld Image" Dim pkPaperSize As New...
2
by: jc_va | last post by:
I need to print a document in landscape mode (using IE6). I see the @page directive, but I can't get it to work. I have searched this forum, but don't see many articles on printing landscape that...
0
by: atagore | last post by:
Anyone have a sample CSS style sheet for printing landscape from IE browser using Oracle Reports 10g (version 10.1.2.0.2) ? Andy T
4
by: chemlight | last post by:
I seem to remember from somewhere that there is a PHP library for converting a php page into an image, and rotating it for printing in landscape. I haven't been able to find anything on google, or...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.