Exemplo n.º 1
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();
            }
        }
        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();
            }
        }