change "page setup" printer C#

  • Thread starter Thread starter Sean McKaharay
  • Start date Start date
[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 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 said:
[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.<
 
Back
Top