public async Task ShowPrintUIAsync()
        {
            // get the number of Pdf pages to print
            NumberOfPhotos = await((FlipPdfViewerControl)hostControl).GetPrintPageCount();

            // Catch and print out any errors reported
            try
            {
                await PrintManager.ShowPrintUIAsync();
            }
            catch (Exception e)
            {
                HostErrorMsgHandler?.Invoke("Error printing: " + e.Message + ", hr=" + e.HResult);
            }
        }
Exemple #2
0
 /// <summary>
 /// Register the control for printing.  This should be called in the OnNavigatedTo override of
 /// the page that hosts this control.
 /// </summary>
 public void RegisterForPrinting()
 {
     if (null != _printHelper)
     {
         _printHelper.RegisterForPrinting();
         PdfStatusMessage = "Registered for Printing";
         HostStatusMsgHandler?.Invoke(PdfStatusMessage);
     }
     else
     {
         PrintingIsSupported = false;
         PdfErrorMessage     = "Printing is not supported.";
         HostErrorMsgHandler?.Invoke(PdfErrorMessage);
     }
 }
Exemple #3
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public FlipPdfViewerControl()
        {
            // default background color
            this.Background = new SolidColorBrush(Colors.DarkGray);

            // hook the keyboard
            Window.Current.CoreWindow.CharacterReceived += CoreWindow_CharacterReceived;

            // Loaded is where we hook up component control event handlers
            Loaded += FlipPdfViewerControl_Loaded;

            // set the default Pdf background color
            PdfBackgroundColor = Windows.UI.Colors.Beige;

            // see if printing is supported by this OS and if so, instantiate the print code.
            if (PrintManager.IsSupported())
            {
                PrintingIsSupported = true;
                _printHelper        = new FlipViewPagePrintHelper(this, SetStatusMessage, SetErrorMessage);
            }
            else
            {
                PrintingIsSupported = false;
                PdfErrorMessage     = "Printing is not supported.";
                HostErrorMsgHandler?.Invoke(PdfErrorMessage);
            }

            this.InitializeComponent();
        }