473,232 Members | 1,419 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,232 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 8379
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
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...

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.