public void Load(IPDFSource source, string password = null)
        {
            virtualPanel            = this.FindChild <CustomVirtualizingPanel>();
            scrollViewer            = this.FindChild <ScrollViewer>();
            virtualPanel.PageBounds = parent.PageBounds.Select(b => b.SizeIncludingOffset).ToArray();
            imageProvider           = new PDFImageProvider(source, parent.PageCount,
                                                           new DisplaySettings(parent.GetPagePer(), parent.ViewType, parent.HMargin, parent.PageRotation),
                                                           password: password);

            if (parent.Zoom == ZoomType.FIXED)
            {
                CreateNewItemsSource();
            }
            else if (parent.Zoom == ZoomType.FIT_HEIGHT)
            {
                ZoomToHeight();
            }
            else if (parent.Zoom == ZoomType.FIT_WIDTH)
            {
                ZoomToWidth();
            }

            if (scrollViewer != null)
            {
                scrollViewer.Visibility = System.Windows.Visibility.Visible;
                scrollViewer.ScrollToTop();
            }
        }
Esempio n. 2
0
        public void Load(Interop.IPDFSource source, string password = null)
        {
            scrollViewer  = this.FindChild <ScrollViewer>();
            imageProvider = new PDFImageProvider(source, parent.PageCount,
                                                 new DisplaySettings(parent.GetPagePer(), parent.ViewType, parent.HMargin, parent.PageRotation),
                                                 false, password);
            pageIndex = 0;
            if (scrollViewer != null)
            {
                scrollViewer.Visibility = System.Windows.Visibility.Visible;
            }

            if (parent.Zoom == ZoomType.FIXED)
            {
                SetItemSource();
            }
            else if (parent.Zoom == ZoomType.FIT_HEIGHT)
            {
                ZoomToHeight();
            }
            else if (parent.Zoom == ZoomType.FIT_WIDTH)
            {
                ZoomToWidth();
            }
        }
Esempio n. 3
0
 public void Unload()
 {
     scrollViewer.Visibility = System.Windows.Visibility.Collapsed;
     scrollViewer.ScrollToHorizontalOffset(0);
     scrollViewer.ScrollToVerticalOffset(0);
     pageIndex     = 0;
     imageProvider = null;
 }
        public void Unload()
        {
            scrollViewer.Visibility = System.Windows.Visibility.Collapsed;
            scrollViewer.ScrollToHorizontalOffset(0);
            scrollViewer.ScrollToVerticalOffset(0);
            imageProvider = null;

            if (virtualPDFPages != null)
            {
                virtualPDFPages.CleanUpAllPages();
                virtualPDFPages = null;
            }

            itemsControl.ItemsSource = null;
        }