Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            FillColorCombos();

            this.AnnotationViewer.Annotations.HotSpotClicked             += new EventHandler <EventArgs <WpfAnnotationUI> >(Annotations_HotSpotClicked);
            this.AnnotationViewer.Annotations.SelectedAnnotationsChanged += new EventHandler(Annotations_SelectedAnnotationsChanged);
            this.AnnotationViewer.ImageViewer.IsCentered = true;

            this.AnnotationViewer.Annotations.Factories.Add(new WpfAnnotationUIFactory <TriangleAnnotation, TriangleData>());

            PrepareToolbar();

            try
            {
                // This requires a PDF Reader license.
                PdfDecoder decoder = new PdfDecoder();
                decoder.RenderSettings.AnnotationSettings = AnnotationRenderSettings.None;
                RegisteredDecoders.Decoders.Add(decoder);
            }
            catch
            {
            }
        }
Esempio n. 2
0
        public MainForm()
        {
            InitializeComponent();

            try
            {
                _pdfDecoder = new PdfDecoder
                {
                    Resolution     = 150,
                    RenderSettings = new RenderSettings {
                        AnnotationSettings = AnnotationRenderSettings.RenderNone
                    }
                };

                //add the PDF Rasterizer as a decoder
                RegisteredDecoders.Decoders.Insert(0, _pdfDecoder);
            }
            catch (AtalasoftLicenseException)
            {
                _menuFile.Enabled = false;
                ShowLicenseMessage("PdfRasterizer");
            }

            _workspaceViewer.ImageBorderPen = new AtalaPen(Color.Black, 1);
            _workspaceViewer.Annotations.Layers.Add(new LayerAnnotation());
            _workspaceViewer.MouseWheel += WorkspaceViewerOnMouseWheel;

            _tabControl.ImageList = new ImageList {
                ImageSize = new Size(32, 32)
            };
            _tabControl.ImageList.Images.AddRange(new Image[] { Resources.PagesTabImage, Resources.BookmarkTabImage });

            _treeBookmarks.ImageList = new ImageList();
            _treeBookmarks.ImageList.Images.Add(Resources.BookmarkGray);
        }
        public Form1()
        {
            InitializeComponent();
            LoadAnnotationToolbarImages();
            EnableDisableMenuAndToolbarItems();
            AtalaDemos.HelperMethods.PopulateDecoders(RegisteredDecoders.Decoders);

            this.documentAnnotationViewer1.SelectedIndexChanged += new EventHandler(documentAnnotationViewer1_SelectedIndexChanged);

            this.documentAnnotationViewer1.Annotations.SelectionChanged  += new EventHandler(documentAnnotationViewer1_Annotations_SelectionChanged);
            this.documentAnnotationViewer1.Annotations.Rotated           += new AnnotationEventHandler(documentAnnotationViewer1_AnnotationRotated);
            this.documentAnnotationViewer1.Annotations.Resized           += new AnnotationEventHandler(documentAnnotationViewer1_AnnotationResized);
            this.documentAnnotationViewer1.Annotations.Moved             += new AnnotationEventHandler(documentAnnotationViewer1_AnnotationMoved);
            this.documentAnnotationViewer1.Annotations.AnnotationCreated += new AnnotationEventHandler(documentAnnotationViewer1_AnnotationCreated);

            this.documentAnnotationViewer1.SelectFirstPageOnOpen      = true;
            this.documentAnnotationViewer1.Annotations.ClipToDocument = true;

            // We Need to add the ability to directly handle embedded annotations
            int PdfRes = 96;

            foreach (object decoder in RegisteredDecoders.Decoders)
            {
                if (decoder.GetType() == typeof(PdfDecoder))
                {
                    PdfDecoder pdfDec = decoder as PdfDecoder;
                    PdfRes = pdfDec.Resolution;
                    break;
                }
            }
            this.documentAnnotationViewer1.AnnotationDataProvider           = new Atalasoft.Annotate.UI.EmbeddedAnnotationDataProvider(new PointF(PdfRes, PdfRes));
            this.documentAnnotationViewer1.CreatePdfAnnotationDataExporter += new CreatePdfAnnotationDataExporterHandler(documentAnnotationViewer1_CreatePdfAnnotationDataExporter);
        }