Inheritance: System.Windows.Documents.DocumentPaginator, IDocumentPaginatorSource
Beispiel #1
0
        private void ThreadProc(object param)
        {
            IntPtr hwnd = (IntPtr)param;
            var    dlg  = new ThreadSafePrintDialog();

            dlg.MinPage              = 1;
            dlg.MaxPage              = (uint)_document.Pages.Count;
            dlg.PageRange            = new System.Windows.Controls.PageRange((int)dlg.MinPage, (int)dlg.MaxPage);
            dlg.UserPageRangeEnabled = true;

            if (hwnd == IntPtr.Zero || dlg.ShowDialog(hwnd) == true)
            {
                OnPrintStarted();
                var    printTicket         = dlg.PrintTicket;
                double printableAreaWidth  = dlg.PrintableAreaWidth;
                double printableAreaHeight = dlg.PrintableAreaHeight;

                var paginator = new PdfDocumentPaginator(_document, dlg.PageRange);
                paginator.PagePrinted  += Paginator_PagePrinted;
                paginator.PrinterTicket = printTicket;
                paginator.PageSize      = new Size(printableAreaWidth, printableAreaHeight);
                dlg.PrintDocument(paginator, _document.Title);
                OnPrintCompleted();
            }
            IsBusy = false;
        }
Beispiel #2
0
		private void ThreadProc(object param)
		{
			IntPtr hwnd = (IntPtr)param;
			var dlg = new ThreadSafePrintDialog();
			dlg.MinPage = 1;
			dlg.MaxPage = (uint)_document.Pages.Count;
			dlg.PageRange = new System.Windows.Controls.PageRange((int)dlg.MinPage, (int)dlg.MaxPage);
			dlg.UserPageRangeEnabled = true;

			if (hwnd==IntPtr.Zero || dlg.ShowDialog(hwnd) == true)
			{
				OnPrintStarted();
				var printTicket = dlg.PrintTicket;
				double printableAreaWidth = dlg.PrintableAreaWidth;
				double printableAreaHeight = dlg.PrintableAreaHeight;

				var paginator = new PdfDocumentPaginator(_document, dlg.PageRange);
				paginator.PagePrinted += Paginator_PagePrinted;
				paginator.PrinterTicket = printTicket;
				paginator.PageSize = new Size(printableAreaWidth, printableAreaHeight);
				dlg.PrintDocument(paginator, _document.Title);
				OnPrintCompleted();
			}
			IsBusy = false;
		}