Example #1
0
        protected void LoadDocument(IntPtr doc)
        {
            _document = doc;

            PdfiumLibrary.FPDF_GetDocPermissions(_document);

            _formCallbacks       = new API.FPDF_FORMFILLINFO();
            _formCallbacksHandle = GCHandle.Alloc(_formCallbacks, GCHandleType.Pinned);

            for (int i = 1; i <= 2; i++)
            {
                _formCallbacks.version = i;

                _form = PdfiumLibrary.FPDFDOC_InitFormFillEnvironment(_document, _formCallbacks);
                if (_form != IntPtr.Zero)
                {
                    break;
                }
            }

            PdfiumLibrary.FPDF_SetFormFieldHighlightColor(_form, 0, 0xFFE4DD);
            PdfiumLibrary.FPDF_SetFormFieldHighlightAlpha(_form, 100);

            PdfiumLibrary.FORM_DoDocumentJSAction(_form);
            PdfiumLibrary.FORM_DoDocumentOpenAction(_form);

            Bookmarks = new PdfBookmarkCollection();

            LoadBookmarks(Bookmarks, PdfiumLibrary.FPDFBookmark_GetFirstChild(_document, IntPtr.Zero));
        }