467,879 Members | 1,210 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,879 developers. It's quick & easy.

change "page setup" printer C#

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

Nov 16 '05 #1
  • viewed: 13355
Share:
2 Replies
[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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Humpdydum | last post: by
2 posts views Thread by Munnu | last post: by
1 post views Thread by Matt | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.