473,804 Members | 3,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(o bject sender, EventArgs e) {
printDocument1. Print();
}

private void printDocument1_ PrintPage(objec t sender,
System.Drawing. Printing.PrintP ageEventArgs e) {
e.PageSettings. Landscape = true;

e.Graphics.Draw String(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 8467
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 DefaultPageSett ing property on the PrintDocument
class?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"FireStarte r" <d@d.comwrote in message
news:eJ******** ******@TK2MSFTN GP02.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(o bject sender, EventArgs e) {
printDocument1. Print();
}

private void printDocument1_ PrintPage(objec t sender,
System.Drawing. Printing.PrintP ageEventArgs e) {
e.PageSettings. Landscape = true;

e.Graphics.Draw String(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 DefaultPageSett ing 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
3026
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 of the printing, I arranged the graphic elements on the page the way it should be. When I got to printing text, it went across the page, not down as I need it to go. I tried to use the hDC.SetWorldTransform(0, -1, 1, 0, 0, 0) command to rotate...
4
4862
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 selected. For example, if I were to have 5 pages with every second page printing, I would get the following results: Page 1 = Print OK Page 2 = Blank Page 3 = Print OK Page 4 = Blank
3
10616
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 myDocument As PrintDocument = PreparePrintDocument() Dim myPaperSize As PaperSize Dim iSizeCount As Integer Dim dlgPrint As New PrintDialog
2
1305
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
4121
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
31955
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 Printing.PaperSize("sdfgsfdg", 850, 1100)
2
2886
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 are relatively recent. Is there still no reliable way to print LS with IE6? That's our company standard, so I can't tell our VPs to change their browser.
0
1596
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
3149
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 bytes. A lot of chatter about the @page CSS properties (which don't work). Not what I need though... A point in the right direction would be appreciated.
0
10571
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10326
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.