By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,201 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,201 IT Pros & Developers. It's quick & easy.

change "page setup" printer C#

P: n/a
I want to find out how I can change the page orientation of a printer.

Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
[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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.