예제 #1
0
        private void PrepareContent()
        {
            if (page1 == null)
            {
                page1 = new PageForPrinting();
                StackPanel header = (StackPanel)page1.FindName("header");
                header.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }

            PrintContainer.Children.Add(page1);
            PrintContainer.InvalidateMeasure();
            PrintContainer.UpdateLayout();
        }
예제 #2
0
        private void PrepareContent()
        {
            if (page1 == null)
            {
                page1 = new PageForPrinting();
            }

            //this xaml canvas
            PrintContainer.Children.Add(page1);

            PrintContainer.InvalidateMeasure();

            PrintContainer.UpdateLayout();
        }
예제 #3
0
        private RichTextBlockOverflow AddOnePrintPreviewPage(RichTextBlockOverflow lastRTBOAdded, PrintPageDescription printPageDescription)
        {
            FrameworkElement      page;
            RichTextBlockOverflow link;

            if (lastRTBOAdded == null)
            {
                page = page1;
                StackPanel footer = (StackPanel)page.FindName("footer");
                footer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
            else
            {
                page = new ContinuationPage(lastRTBOAdded);
            }

            page.Width  = printPageDescription.PageSize.Width;
            page.Height = printPageDescription.PageSize.Height;

            Grid printableArea = (Grid)page.FindName("printableArea");

            double marginWidth  = Math.Max(printPageDescription.PageSize.Width - printPageDescription.ImageableRect.Width, printPageDescription.PageSize.Width * left * 2);
            double marginHeight = Math.Max(printPageDescription.PageSize.Height - printPageDescription.ImageableRect.Height, printPageDescription.PageSize.Height * top * 2);

            printableArea.Width  = page1.Width - marginWidth;
            printableArea.Height = page1.Height - marginHeight;

            PrintContainer.Children.Add(page);
            PrintContainer.InvalidateMeasure();
            PrintContainer.UpdateLayout();

            // Find the last text container and see if the content is overflowing
            link = (RichTextBlockOverflow)page.FindName("continuationPageLinkedContainer");

            // Check if this is the last page
            if (!link.HasOverflowContent && link.Visibility == Windows.UI.Xaml.Visibility.Visible)
            {
                StackPanel footer = (StackPanel)page.FindName("footer");
                footer.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }

            // Add the page to the page preview collection
            pages.Add(page);

            return(link);
        }
예제 #4
0
        //This method does all of the heavy lifting for us, calculating the size of the page,
        //setting margins, and saving them to the pages List<>.
        private RichTextBlockOverflow AddOnePrintPreviewPage(RichTextBlockOverflow lastRTBOAdded, PrintPageDescription printPageDescription)
        {
            //This method does all of the heavy lifting for us, calculating the size of the
            //page, setting margins, and saving them to the pages List<>.
            FrameworkElement      page;
            RichTextBlockOverflow link;

            if (lastRTBOAdded == null)
            {
                page = page1;
            }
            else
            {
                page = new ContinuesPage(lastRTBOAdded);
            }

            page.Width  = printPageDescription.PageSize.Width;
            page.Height = printPageDescription.PageSize.Height;

            Grid printableArea = (Grid)page.FindName("printableArea");

            double marginWidth  = Math.Max(printPageDescription.PageSize.Width - printPageDescription.ImageableRect.Width, printPageDescription.PageSize.Width * left * 2);
            double marginHeight = Math.Max(printPageDescription.PageSize.Height - printPageDescription.ImageableRect.Height, printPageDescription.PageSize.Height * top * 2);

            printableArea.Width  = page1.Width - marginWidth;
            printableArea.Height = page1.Height - marginHeight;

            PrintContainer.Children.Add(page);
            PrintContainer.InvalidateMeasure();
            PrintContainer.UpdateLayout();

            // Find the last text container and see if the content is overflowing
            link = (RichTextBlockOverflow)page.FindName("continuationPageLinkedContainer");

            // Add the page to the page preview collection
            pages.Add(page);

            return(link);
        }