コード例 #1
0
        /// <summary>
        /// When we leave the page, unregister the FlipPdfViewer from the print system.
        /// </summary>
        /// <param name="e">NavigationEventArgs, ignored here.</param>
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            if (PrintingIsSupported)
            {
                FlipPdfViewer.UnRegisterForPrinting();
            }

            SizeChanged -= LoadPdf_SizeChanged;
        }
コード例 #2
0
        /// <summary>
        /// Triggered by the MainPage's PdfFrame.Navigate calls in the various Button
        /// event handlers for loading Pdf documents from embedded PDF files, the file system,
        /// or an Internet URI.
        /// </summary>
        /// <param name="e">NavigationEventArgs, a NavigationContext object.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // cast the passed parameter as a NavigationContext object
            var parameters = e.Parameter as NavigationContext;

            SizeChanged += LoadPdf_SizeChanged;

            // if we actually have a NavigationContext object passed...
            if (null != parameters)
            {
                // set the FlipPdfViewer's background color before rendering
                FlipPdfViewer.PdfBackgroundColor = parameters.BackgroundColor;

                bool isFile = parameters.IsFile;

                // if the passed NavigationContext is a StorageFile
                if (isFile)
                {
                    StorageFile pdfFile = parameters.PdfFile;

                    // Open the Pdf file through the FlipPdfViewer's StorageFileSource
                    // property directly.  This will trigger loading the PDF file.
                    FlipPdfViewer.StorageFileSource = pdfFile;

                    ForwardStatusMessage("Opening PDF File from Storage");
                }
                else
                {
                    // It's not a file but a Uri, so set our Uri property,
                    // bound to the FlipPdfViewer in XAML, which will trigger
                    // loading the PDF file.
                    PdfSource = parameters.PdfUri;
                }

                PrintingIsSupported = FlipPdfViewer.PrintingIsSupported;

                // set forward message delegate instances
                FlipPdfViewer.HostStatusMsgHandler = ForwardStatusMessage;
                FlipPdfViewer.HostErrorMsgHandler  = ForwardErrorMessage;

                // if the FlipPdfViewer supports printing, register it with the print system.  We do this here
                // so it can be unregisterd in OnNavigatedFrom.
                if (PrintingIsSupported)
                {
                    // register FlipPdfViewer for printing
                    FlipPdfViewer.RegisterForPrinting();
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Print the current Pdf document.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void OnPrintButtonClick(object sender, RoutedEventArgs e)
 {
     await FlipPdfViewer.OnPrintButtonClick();
 }
コード例 #4
0
 /// <summary>
 /// Restore the current page of the FlipPdfViewer to its original size and aspect ratio.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DoFitDocumentImageToScreen(object sender, RoutedEventArgs e)
 {
     FlipPdfViewer.ZoomReset();
 }
コード例 #5
0
 /// <summary>
 /// Zoom out of the current page of the FlipPdfViewer.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ZoomOut(object sender, RoutedEventArgs e)
 {
     FlipPdfViewer.ZoomOut();
 }
コード例 #6
0
 /// <summary>
 /// Increment the Pdf page shown in the FlipPdfViewer.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MoveFlipViewForward(object sender, RoutedEventArgs e)
 {
     FlipPdfViewer.IncrementPage();
 }
コード例 #7
0
 /// <summary>
 /// Decrement the Pdf page shown in the FlipPdfViewer.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MoveFlipViewBack(object sender, RoutedEventArgs e)
 {
     FlipPdfViewer.DecrementPage();
 }
コード例 #8
0
 /// <summary>
 /// We have to resize the Pdf page currently displayed when we resize.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LoadPdf_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     FlipPdfViewer.ZoomReset();
 }