473,386 Members | 1,720 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,386 software developers and data experts.

change "page setup" printer C#

I want to find out how I can change the page orientation of a printer.

Nov 16 '05 #1
2 13609
[C#]
public void Printing() {
try {
streamToPrint = new StreamReader (filePath);
try {
printFont = new Font("Arial", 10);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
pd.PrinterSettings.PrinterName = printer;
// Set the page orientation to landscape.
pd.DefaultPageSettings.Landscape = true; // ********* //
pd.Print();
}
finally {
streamToPrint.Close() ;
}
}
catch(Exception ex) {
MessageBox.Show(ex.Message);
}
}

Regards,
Jeff
I want to find out how I can change the page orientation of a printer.<

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #2
I have the same problem not able to print in landscape. I did do the similar
coding but it's not working. Can you see what I'm doing wrong? Thanks.

private void btnPrint_Click(object sender, System.EventArgs e)
{
pdocNYMedicaid.DefaultPageSettings.Landscape = true;
Margins margins = new Margins(0,0,0,0);
pdocNYMedicaid.DefaultPageSettings.Margins = margins;

PrintDialog pdocDialog = new PrintDialog();
pdocDialog.Document = this.pdocNYMedicaid;
if(pdocDialog.ShowDialog()== DialogResult.OK)
{
pdocNYMedicaid.PrinterSettings = pdocDialog.PrinterSettings;

pdocNYMedicaid.Print();
}
}

"Jeff Louie" wrote:
[C#]
public void Printing() {
try {
streamToPrint = new StreamReader (filePath);
try {
printFont = new Font("Arial", 10);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
pd.PrinterSettings.PrinterName = printer;
// Set the page orientation to landscape.
pd.DefaultPageSettings.Landscape = true; // ********* //
pd.Print();
}
finally {
streamToPrint.Close() ;
}
}
catch(Exception ex) {
MessageBox.Show(ex.Message);
}
}

Regards,
Jeff
I want to find out how I can change the page orientation of a printer.<

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #3

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

Similar topics

0
by: Humpdydum | last post by:
When I run python setup.py bdist --format=zip on Windows 2000, with this setup.py: from distutils.core import setup setup(name="test", version="1.0", description="blabla",
2
by: Munnu | last post by:
How can I make asp page that prints the contact information in 3.5"x5.5" (like business card) area? I have asp page that contains the information for my contact and I need to make one more view on...
3
by: Wardeaux | last post by:
All, I've written a "setup" wrapper that calls a sequence of "setup.exe", and all works except when I call the setup.exe for the MSDE, then it gets about half way through and then hangs... The...
3
by: nan | last post by:
Hi All, I am trying to connect the Database which is installed in AS400 using DB2 Client Version 8 in Windows box. First i created the Catalog, then when i selected the connection type...
0
by: Achim Domma | last post by:
Hi, I try to develop a localized Asp.Net 1.1 application. I have added two resource files to my app, which are called 'Labels.resx' and 'Labels.de.resx'. If I compile the app, I see a 'de'...
2
by: hstierho | last post by:
Using latest version of Access, XP Pro O/S. Using HP 4100 printer. When I choose legal and tray 2, the setting changes back to letter. I have three forms to print. The first form maintains...
1
by: Matt | last post by:
Has anyone had any experience with running into a 22.75" page width limitation with Access reports? I am trying to print a report to a large format printer that is under (including margin) the...
2
by: satnamsarai | last post by:
it is possible to change page orientation to landscape from asp.net page? I am using window.print() dialog to print a page and I would like that page to print automatically in landscape view.
2
by: jkdudhatra | last post by:
How To Change Page Orientation Of Default Printer In Visual Basic At Run Time ?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.