Ejemplo n.º 1
0
        public CustomToolbar()
        {
            parentView = new UIView(this.Frame);
            var tap = new UITapGestureRecognizer(OnSingleTap);

            tap.CancelsTouchesInView = false; //for iOS5
            highFont = UIFont.FromName("Final_PDFViewer_IOS_FontUpdate", 30);
            this.AddGestureRecognizer(tap);
            helper      = new TextMarkupAnnotationHelper(this);
            inkHelper   = new InkAnnotationHelper(this);
            annotHelper = new AnnotationHelper(this);
            opacitybutton.TouchUpInside           += inkHelper.Opacitybutton_TouchUpInside;
            pdfViewerControl                       = new SfPdfViewer();
            pdfViewerControl.Toolbar.Enabled       = false;
            pdfViewerControl.PageChanged          += ViewerControl_PageChanged;
            pdfViewerControl.SearchCompleted      += PdfViewerControl_SearchCompleted;
            pdfViewerControl.TextMarkupSelected   += helper.PdfViewerControl_TextMarkupSelected;
            pdfViewerControl.TextMarkupDeselected += helper.PdfViewerControl_TextMarkupDeselected;
            pdfViewerControl.CanUndoModified      += PdfViewerControl_CanUndoModified;
            pdfViewerControl.CanRedoModified      += PdfViewerControl_CanRedoModified;
            pdfViewerControl.CanUndoInkModified   += inkHelper.PdfViewerControl_CanUndoInkModified;
            pdfViewerControl.CanRedoInkModified   += inkHelper.PdfViewerControl_CanRedoInkModified;
            pdfViewerControl.InkSelected          += inkHelper.PdfViewerControl_InkSelected;
            pdfViewerControl.InkDeselected        += inkHelper.PdfViewerControl_InkDeselected;

            BoldBtn1.TouchUpInside            += inkHelper.BoldColorBtn1_TouchUpInside;
            BoldColorBtn1.TouchUpInside       += inkHelper.BoldColorBtn1_TouchUpInside;
            BoldBtn2.TouchUpInside            += inkHelper.BoldColorBtn2_TouchUpInside;
            BoldColorBtn2.TouchUpInside       += inkHelper.BoldColorBtn2_TouchUpInside;
            BoldBtn3.TouchUpInside            += inkHelper.BoldColorBtn3_TouchUpInside;
            BoldColorBtn3.TouchUpInside       += inkHelper.BoldColorBtn3_TouchUpInside;
            BoldColorBtn4.TouchUpInside       += inkHelper.BoldColorBtn4_TouchUpInside;
            BoldBtn4.TouchUpInside            += inkHelper.BoldColorBtn4_TouchUpInside;
            BoldColorBtn5.TouchUpInside       += inkHelper.BoldColorBtn5_TouchUpInside;
            BoldBtn5.TouchUpInside            += inkHelper.BoldColorBtn5_TouchUpInside;
            inkColorButton.TouchUpInside      += helper.ColorButton_TouchUpInside;
            colorButton.TouchUpInside         += helper.ColorButton_TouchUpInside;
            inkAnnotationButton.TouchUpInside += inkHelper.InkAnnotationButton_TouchUpInside;
            inkThicknessButton.TouchUpInside  += inkHelper.InkThicknessButton_TouchUpInside;
            pageNumberField.Text = "1";
            CreateTopToolbar();
            bottomToolBar = CreateBottomToolbar();
            toolbar       = toolBar;
            parentView.AddSubview(pdfViewerControl);
            AddSubview(parentView);
            AddSubview(toolbar);
            AddSubview(bottomToolBar);
            activityDialog       = new ActivityIndicator();
            activityDialog.Frame = new CGRect(UIScreen.MainScreen.Bounds.Width / 2 - 125, UIScreen.MainScreen.Bounds.Height / 2 - 50, 250, 100);
            popUpAlertView       = new UIAlertView();
            dropDownMenu         = CreateDropDownMenu();
            dropDownMenu.DropDownMenuItemChanged += (e, a) =>
            {
                fileStream = typeof(CustomToolbar).GetTypeInfo().Assembly.GetManifestResourceStream("SampleBrowser.Samples.PDFViewer.Assets." + a.DisplayText + ".pdf");
                pdfViewerControl.LoadDocument(fileStream);
                ResetToolBar();
                annotHelper.RemoveAllToolbars(false);
                dropDownMenu.Close();
            };
        }
Ejemplo n.º 2
0
        private DropDownMenu CreateDropDownMenu()
        {
            var dropDownMenu = new DropDownMenu(this, GetResource().ToArray())
            {
                BackgroundColor = UIColor.Clear,
                TextColor       = UIColor.Black,
                Opacity         = 1,
                BorderWidth     = 1,
                Frame           = new CGRect(0, DefaultToolbarHeight + 20, 250, 200)
            };

            return(dropDownMenu);
        }
Ejemplo n.º 3
0
        public CustomToolbar()
        {
            parentView     = new UIView(this.Frame);
            initialStream  = typeof(CustomToolbar).GetTypeInfo().Assembly.GetManifestResourceStream("SampleBrowser.Samples.PDFViewer.Assets.F# Succinctly.pdf");
            loadedDocument = new PdfLoadedDocument(initialStream);
            PopulateInitialBookmarkList();
            var tap = new UITapGestureRecognizer(OnSingleTap);

            tap.CancelsTouchesInView = false; //for iOS5
            highFont      = UIFont.FromName("Final_PDFViewer_IOS_FontUpdate", 30);
            fontSizeFont  = UIFont.FromName("Font size Font", 30);
            signatureFont = UIFont.FromName("Signature_PDFViewer_FONT", 30);
            //Font that defines the icons for the bookmark toolbar buttons
            bookmarkFont = UIFont.FromName("PdfViewer_FONT", 30);
            this.AddGestureRecognizer(tap);
            helper         = new TextMarkupAnnotationHelper(this);
            inkHelper      = new InkAnnotationHelper(this);
            annotHelper    = new AnnotationHelper(this);
            rangeSlider    = new SfRangeSlider();
            edittextHelper = new EditTextAnnotationHelper(this);
            shapeHelper    = new ShapeAnnotationHelper(this);
            opacitybutton.TouchUpInside                   += inkHelper.Opacitybutton_TouchUpInside;
            pdfViewerControl                               = new SfPdfViewer();
            pdfViewerControl.Toolbar.Enabled               = false;
            pdfViewerControl.PageChanged                  += ViewerControl_PageChanged;
            pdfViewerControl.TextMarkupSelected           += helper.PdfViewerControl_TextMarkupSelected;
            pdfViewerControl.TextMarkupDeselected         += helper.PdfViewerControl_TextMarkupDeselected;
            pdfViewerControl.CanUndoModified              += PdfViewerControl_CanUndoModified;
            pdfViewerControl.CanRedoModified              += PdfViewerControl_CanRedoModified;
            pdfViewerControl.CanUndoInkModified           += inkHelper.PdfViewerControl_CanUndoInkModified;
            pdfViewerControl.CanRedoInkModified           += inkHelper.PdfViewerControl_CanRedoInkModified;
            pdfViewerControl.InkSelected                  += inkHelper.PdfViewerControl_InkSelected;
            pdfViewerControl.InkDeselected                += inkHelper.PdfViewerControl_InkDeselected;
            pdfViewerControl.FreeTextAnnotationAdded      += edittextHelper.PdfViewerControl_FreeTextAnnotationAdded;
            pdfViewerControl.FreeTextAnnotationDeselected += edittextHelper.PdfViewerControl_FreeTextAnnotationDeselected;
            pdfViewerControl.FreeTextAnnotationSelected   += edittextHelper.PdfViewerControl_FreeTextAnnotationSelected;
            pdfViewerControl.FreeTextPopupDisappeared     += edittextHelper.PdfViewerControl_FreeTextPopupDisappearing;
            pdfViewerControl.ShapeAnnotationSelected      += shapeHelper.PdfViewerControl_ShapeAnnotationSelected;
            pdfViewerControl.ShapeAnnotationDeselected    += shapeHelper.PdfViewerControl_ShapeAnnotationDeselected;
            BoldBtn1.TouchUpInside                        += inkHelper.BoldColorBtn1_TouchUpInside;
            BoldColorBtn1.TouchUpInside                   += inkHelper.BoldColorBtn1_TouchUpInside;
            BoldBtn2.TouchUpInside                        += inkHelper.BoldColorBtn2_TouchUpInside;
            BoldColorBtn2.TouchUpInside                   += inkHelper.BoldColorBtn2_TouchUpInside;
            BoldBtn3.TouchUpInside                        += inkHelper.BoldColorBtn3_TouchUpInside;
            BoldColorBtn3.TouchUpInside                   += inkHelper.BoldColorBtn3_TouchUpInside;
            BoldColorBtn4.TouchUpInside                   += inkHelper.BoldColorBtn4_TouchUpInside;
            BoldBtn4.TouchUpInside                        += inkHelper.BoldColorBtn4_TouchUpInside;
            BoldColorBtn5.TouchUpInside                   += inkHelper.BoldColorBtn5_TouchUpInside;
            BoldBtn5.TouchUpInside                        += inkHelper.BoldColorBtn5_TouchUpInside;
            inkColorButton.TouchUpInside                  += helper.ColorButton_TouchUpInside;
            colorButton.TouchUpInside                     += helper.ColorButton_TouchUpInside;
            inkAnnotationButton.TouchUpInside             += inkHelper.InkAnnotationButton_TouchUpInside;
            inkThicknessButton.TouchUpInside              += inkHelper.InkThicknessButton_TouchUpInside;
            shapeThicknessButton.TouchUpInside            += inkHelper.InkThicknessButton_TouchUpInside;
            edittextThicknessButton.TouchUpInside         += edittextHelper.EditTextThicknessButton_TouchUpInside;
            edittextColorButton.TouchUpInside             += helper.ColorButton_TouchUpInside;
            shapeColorButton.TouchUpInside                += helper.ColorButton_TouchUpInside;
            pageNumberField.Text                           = "1";
            CreateTopToolbar();
            bottomToolBar = CreateBottomToolbar();
            toolbar       = toolBar;
            parentView.AddSubview(pdfViewerControl);
            AddSubview(parentView);
            AddSubview(toolbar);
            AddSubview(bottomToolBar);
            topBorder.BackgroundColor = UIColor.FromRGBA(red: 0.86f, green: 0.86f, blue: 0.86f, alpha: 1.0f);
            AddSubview(topBorder);
            activityDialog       = new ActivityIndicator();
            activityDialog.Frame = new CGRect(UIScreen.MainScreen.Bounds.Width / 2 - 125, UIScreen.MainScreen.Bounds.Height / 2 - 50, 250, 100);
            popUpAlertView       = new UIAlertView();
            dropDownMenu         = CreateDropDownMenu();
            dropDownMenu.DropDownMenuItemChanged += (e, a) =>
            {
                fileStream     = typeof(CustomToolbar).GetTypeInfo().Assembly.GetManifestResourceStream("SampleBrowser.Samples.PDFViewer.Assets." + a.DisplayText + ".pdf");
                loadedDocument = new PdfLoadedDocument(fileStream);
                PopulateInitialBookmarkList();
                pdfViewerControl.LoadDocument(fileStream);
                isBookmarkPaneVisible = false;
                if (bookmarkToolbar != null && bookmarkToolbar.Superview != null)
                {
                    bookmarkToolbar.RemoveFromSuperview();
                }
                ResetToolBar();
                annotHelper.RemoveAllToolbars(false);
                dropDownMenu.Close();
            };
        }