change "page setup" printer C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sean McKaharay

    change "page setup" printer C#

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



  • Jeff Louie

    #2
    Re: change "page setup" printer C#

    [C#]
    public void Printing() {
    try {
    streamToPrint = new StreamReader (filePath);
    try {
    printFont = new Font("Arial", 10);
    PrintDocument pd = new PrintDocument() ;
    pd.PrintPage += new PrintPageEventH andler(pd_Print Page);
    pd.PrinterSetti ngs.PrinterName = printer;
    // Set the page orientation to landscape.
    pd.DefaultPageS ettings.Landsca pe = true; // ********* //
    pd.Print();
    }
    finally {
    streamToPrint.C lose() ;
    }
    }
    catch(Exception ex) {
    MessageBox.Show (ex.Message);
    }
    }

    Regards,
    Jeff[color=blue]
    >I want to find out how I can change the page orientation of a printer.<[/color]


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

    Comment

    • Alpha

      #3
      Re: change &quot;page setup&quot; printer C#

      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.EventArg s e)
      {
      pdocNYMedicaid. DefaultPageSett ings.Landscape = true;
      Margins margins = new Margins(0,0,0,0 );
      pdocNYMedicaid. DefaultPageSett ings.Margins = margins;

      PrintDialog pdocDialog = new PrintDialog();
      pdocDialog.Docu ment = this.pdocNYMedi caid;
      if(pdocDialog.S howDialog()== DialogResult.OK )
      {
      pdocNYMedicaid. PrinterSettings = pdocDialog.Prin terSettings;



      pdocNYMedicaid. Print();
      }
      }

      "Jeff Louie" wrote:
      [color=blue]
      > [C#]
      > public void Printing() {
      > try {
      > streamToPrint = new StreamReader (filePath);
      > try {
      > printFont = new Font("Arial", 10);
      > PrintDocument pd = new PrintDocument() ;
      > pd.PrintPage += new PrintPageEventH andler(pd_Print Page);
      > pd.PrinterSetti ngs.PrinterName = printer;
      > // Set the page orientation to landscape.
      > pd.DefaultPageS ettings.Landsca pe = true; // ********* //
      > pd.Print();
      > }
      > finally {
      > streamToPrint.C lose() ;
      > }
      > }
      > catch(Exception ex) {
      > MessageBox.Show (ex.Message);
      > }
      > }
      >
      > Regards,
      > Jeff[color=green]
      > >I want to find out how I can change the page orientation of a printer.<[/color]
      >
      >
      > *** Sent via Developersdex http://www.developersdex.com ***
      > Don't just participate in USENET...get rewarded for it!
      >[/color]

      Comment

      Working...