Ejemplo n.º 1
0
        /// <summary>
        /// Launch the FileOpenPicker and get the name of a PDF document to load. This is
        /// an async method because it awaits an async method, but it doesn't return a
        /// Task so it can match the click handler signature.
        /// </summary>
        private async void LoadDocument()
        {
            LoadButton.IsEnabled = false;

            var picker = new FileOpenPicker();

            picker.FileTypeFilter.Add(".pdf");
            StorageFile file = await picker.PickSingleFileAsync();

            // if the FileOpenPicker gave us a filename, create a NavigationContext object
            // and set its parameters to pass to the LoadPdf page.
            if (null != file)
            {
                var nav = new NavigationContext();

                nav.IsFile  = true;
                nav.PdfFile = file;

                nav.BackgroundColor = GetPdfBackgroundColor();

                // update the displayed loaded PDF name
                SourceDisplayName = file.Name;

                // navigate to the LoadPdf page
                PdfFrame.Navigate(typeof(Views.LoadPdf), nav);
            }

            LoadButton.IsEnabled = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This loads a PDF file from an Internet URI.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadFromUri_Click(object sender, RoutedEventArgs e)
        {
            var uri = new Uri("http://www.adobe.com/content/dam/Adobe/en/accessibility/products/acrobat/pdfs/acrobat-x-accessible-pdf-from-word.pdf");

            var nav = new NavigationContext();

            nav.IsFile = false;
            nav.PdfUri = uri;

            nav.BackgroundColor = GetPdfBackgroundColor();

            // update the displayed loaded PDF name
            SourceDisplayName = uri.ToString();

            // navigate to the LoadPdf page
            PdfFrame.Navigate(typeof(Views.LoadPdf), nav);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This loads an embedded PDF file from the Assets directory.  Remember, any PDF file
        /// you want to load from Assets has to have its Build Action set to Content in Properties.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadFromAssets_Click(object sender, RoutedEventArgs e)
        {
            var uri = new Uri("ms-appx:///Assets/semanticzoom.pdf");

            var nav = new NavigationContext();

            nav.IsFile = false;
            nav.PdfUri = uri;

            nav.BackgroundColor = GetPdfBackgroundColor();

            // update the displayed loaded PDF name
            SourceDisplayName = uri.ToString();

            // navigate to the LoadPdf page
            PdfFrame.Navigate(typeof(Views.LoadPdf), nav);
        }