/// <summary>
        /// Create the viewer control.
        /// </summary>
        public PdfViewerWPF()
        {
            LogFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\Log.log";
            Logger.LogInfo("Creating PdfViewerWPF instance");

            controller = new PdfViewerController(BeginInvokeCallbackOnDispatcher);
            pane       = new PdfViewerPane();
            Logger.LogInfo("Created PdfViewerWPF instance");

            pane.TextSelected += OnTextSelected;

            UseLayoutRounding   = true;
            SnapsToDevicePixels = true;

            controller.PageCountChanged        += OnPageCountChanged;
            controller.VisiblePageRangeChanged += OnPageNoChanged;
            controller.FitModeChanged          += OnFitModeChanged;
            controller.PageLayoutModeChanged   += OnPageLayoutModeChanged;
            controller.ResolutionChanged       += OnResolutionChanged;
            controller.BorderChanged           += OnBorderChanged;
            controller.ZoomChanged             += OnZoomChanged;
            controller.RotationChanged         += OnRotationChanged;
            controller.SearchCompleted         += OnSearchCompleted;
            controller.OpenCompleted           += OnOpenCompleted;
            controller.Initialize();
        }
Beispiel #2
0
 public void SetController(IPdfViewerController controller)
 {
     this.controller             = controller;
     controller.OutlinesChanged += OnOutlineItemsLoaded;
     controller.OpenCompleted   += OnDocumentLoaded;
     controller.CloseCompleted  += OnCloseCompleted;
 }
Beispiel #3
0
            public OutlineTreeViewItem(PdfOutlineItem outlineItem, IPdfViewerController controller)
                : this(controller)
            {
                this.Header       = outlineItem.title;
                this._destination = outlineItem.dest;
                this._id          = outlineItem.id;

                this.Expanded += ExpandEventHandler;
            }
        public void SetController(IPdfViewerController controller)
        {
            this.controller              = controller;
            controller.BitmapChanged    += SetBitmap;
            controller.SearchCompleted  += SearchCompletedEventHandler;
            controller.CloseCompleted   += OnCloseCompletedEventHandler;
            controller.PageOrderChanged += OnPageOrderChangedEventHandler;

            controller.AnnotationsChanged += OnAnnotationsChangedEventHandler; //[InkingForPDF]
        }
Beispiel #5
0
 //insert a stub, until we loaded the actual data
 public OutlineTreeViewItem(IPdfViewerController controller)
 {
     this.Header     = "Loading";
     this.controller = controller;
     _id             = -1;
 }
 public void SetController(IPdfViewerController controller)
 {
     this.controller            = controller;
     controller.ThumbnailHeight = thumbnailSize;
     controller.ThumbnailWidth  = thumbnailSize;
 }
            public ThumbnailItem(int ID, int NoOfThumbnails, IPdfViewerController controller, Action <ThumbnailItem> setSelection, Action <ThumbnailItem> scrollIntoView)
            {
                //set size to be automatically determined by children
                this.Width     = double.NaN;
                this.Height    = double.NaN;
                this.MinWidth  = thumbnailSize;
                this.MinHeight = thumbnailSize;

                this.controller     = controller;
                this.setSelection   = setSelection;
                this.scrollIntoView = scrollIntoView;
                controller.VisiblePageRangeChanged += OnVisiblePageRangeChanged;

                this._ID             = ID;
                this._noOfThumbnails = NoOfThumbnails;
                this._fileName       = controller.FileName;

                //row/column definitions
                ColumnDefinition c = new ColumnDefinition();

                c.Width = new GridLength(thumbnailSize, GridUnitType.Auto);
                this.ColumnDefinitions.Add(c);
                RowDefinition r = new RowDefinition();

                r.Height = new GridLength(thumbnailSize, GridUnitType.Auto);
                this.RowDefinitions.Add(r);
                RowDefinition r2 = new RowDefinition();

                r2.Height = new GridLength(thumbnailSize / 5, GridUnitType.Auto);
                this.RowDefinitions.Add(r2);

                //add elements
                this.text = new TextBlock();

                this.text.HorizontalAlignment = HorizontalAlignment.Center;
                this.text.VerticalAlignment   = VerticalAlignment.Center;
                Grid.SetColumn(this.text, 0);
                Grid.SetRow(this.text, 1);
                this.Children.Add(this.text);

                this.image = new Image();
                border     = new Border();

                border.BorderBrush     = Brushes.DarkGray;
                border.BorderThickness = new Thickness(1);
                border.Margin          = new Thickness(0.0);
                image.Margin           = new Thickness(0.0);

                Grid.SetColumn(border, 0);
                Grid.SetRow(border, 0);
                this.Children.Add(border);

                //this._pageNo = pageNo;

                this.HorizontalAlignment = HorizontalAlignment.Center;
                this.VerticalAlignment   = VerticalAlignment.Center;
                this.Margin     = new Thickness(5.0);
                this.MouseDown += MouseDownEventHandler;

                this.image.Source = emptyWriteableBitmap;


                image.VerticalAlignment   = VerticalAlignment.Top;
                image.HorizontalAlignment = HorizontalAlignment.Left;
                image.Stretch             = Stretch.Uniform;



                //border.Child = r;
                border.Child  = image;
                border.Width  = Double.NaN;
                border.Height = Double.NaN;
                //this.UpdateLayout();
                InvalidateVisual();
            }
 public void SetController(IPdfViewerController controller)
 {
     this.controller = controller;
     controller.ScrollableAreaChanged    += onScrollableAreaChanged;
     controller.ViewportRectangleChanged += onViewportRectangleChanged;
 }