Beispiel #1
0
        private void OnPrint(object sender, RoutedEventArgs e)
        {
            var printDialog = new PrintDialog();

            if (printDialog.ShowDialog() == true)
            {
                var dataSet = new DataSet();
                dataSet.ReadXmlSchema("store.xsd");
                dataSet.ReadXml("store.xml");

                DocumentPaginator paginator = new StoreDataSetPaginator(dataSet.Tables[0],
                                                                        new Typeface("Calibri"), 24, 96 * 0.75,
                                                                        new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight));

                printDialog.PrintDocument(paginator, "Custom-Printed Pages");
            }
        }
        private void cmdPrint_Click(object sender, RoutedEventArgs e)
        {
            PrintDialog printDialog = new PrintDialog();
            if (printDialog.ShowDialog() == true)
            {
                DataSet ds = new DataSet();
                ds.ReadXmlSchema("store.xsd");
                ds.ReadXml("store.xml");

                StoreDataSetPaginator paginator = new StoreDataSetPaginator(ds.Tables[0],
                    new Typeface("Calibri"), 24, 96*0.75,
                    new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight)); 
                
                printDialog.PrintDocument(paginator, "Custom-Printed Pages");
            }

        }