Wednesday, January 30, 2013

Printing Multiple pages in silverlight

using System.Windows.Printing;


namespace TestProject
{
    public partial class MainPage : UserControl
    {


   public MainPage()
        {

            InitializeComponent();
       
}
       int pagecount = 0;
 List<UIElement> pagesList1 = new List<UIElement>();
        private void btF11_Click(object sender, RoutedEventArgs e)
            {
            PrintDocument prtDoc = new PrintDocument();
            prtDoc.PrintPage +=new EventHandler<PrintPageEventArgs>(prtDoc_PrintPage);
            F11Dealer newDealer = new F11Dealer();
            F11Customer newcustomer = new F11Customer();

    pagesList1.Add(newDealer);
            pagecount++;
            pagesList1.Add(newcustomer);
            pagecount++;
            prtDoc.Print("F11 Report");

            }
    void prtDoc_PrintPage(object sender, PrintPageEventArgs e)
            {

            e.PageVisual = pagesList1[prtDoc.PrintedPageCount];
            e.HasMorePages = prtDoc.PrintedPageCount < (pagecount - 1);
  
            }


reference:
http://eswarbandaru.blogspot.in/2011/02/print-mulitple-pages-using-silverlight.html


No comments:

Post a Comment