Ask a questionAsk a question
 

AnswerHow do I setup the Printing page properly in WPF?

  • Monday, November 02, 2009 2:43 AMSuHlaing Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi All,

    In my project, I use Crystal XI and Visual studio 2008 with C#.
    I try to print out the report from my project. My paper size is the specific one. The size is 9" (width), 7"("height"). My paper look like the voucher paper, there are holes besides of the paper and it is the continuous paper
    So I created the custom paper size in the printer server properties. After then I choose this custom paper size in the printer setup of Crystal report design view.
    When I preview the report, my custom paper is effective and the format and paper size are fixed as I want.
    When I print the report , all data are shown in the right position. After finished the printing, the paper is ejected some more. My printer name is EPSON LQ-300+II ESC/P2. Actually, the printer should be stopped at the end of the page. Now paper is ejected till one third of the second paper.

    If you have solution, let me know.

    Thanks in advance
    Su Hlaing

Answers

  • Wednesday, November 04, 2009 11:01 AMJim Zhou - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi SuHlaing,

    You can set the print configuration to creat the appropriate printing, the following is some code sample:

    System.Windows.Controls.PrintDialog Printdlg = new System.Windows.Controls.PrintDialog();
     Size pageSize = new Size(Printdlg.PrintableAreaWidth - width, Printdlg.PrintableAreaHeight - height);
    //sizing of the element.
    printUIElement.Measure(pageSize);
    printUIElement.Arrange(new Rect(5, 5, pageSize.Width, pageSize.Height));
    Printdlg.PrintVisual(printUIElement, Title);

    Thanks.
    Sincerely.
    Jim Zhou -MSFT

All Replies

  • Wednesday, November 04, 2009 11:01 AMJim Zhou - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi SuHlaing,

    You can set the print configuration to creat the appropriate printing, the following is some code sample:

    System.Windows.Controls.PrintDialog Printdlg = new System.Windows.Controls.PrintDialog();
     Size pageSize = new Size(Printdlg.PrintableAreaWidth - width, Printdlg.PrintableAreaHeight - height);
    //sizing of the element.
    printUIElement.Measure(pageSize);
    printUIElement.Arrange(new Rect(5, 5, pageSize.Width, pageSize.Height));
    Printdlg.PrintVisual(printUIElement, Title);

    Thanks.
    Sincerely.
    Jim Zhou -MSFT
  • Friday, November 06, 2009 2:37 AMSuHlaing Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Jim Zhou,
    I try with your code.




    Thanks
    Su Hlaing
  • Friday, November 06, 2009 8:53 AMJim Zhou - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi SuHlaing,

    If you are still having issues with this, please feel free to feed back.

    Thanks.
    Sincerely.


    Jim Zhou -MSFT