protected void LoadDocument(IntPtr document) { _document = document; NativeMethods.FPDF_GetDocPermissions(_document); _formCallbacks = new NativeMethods.FPDF_FORMFILLINFO(); _formCallbacksHandle = GCHandle.Alloc(_formCallbacks, GCHandleType.Pinned); // Depending on whether XFA support is built into the PDFium library, the version // needs to be 1 or 2. We don't really care, so we just try one or the other. for (int i = 1; i <= 2; i++) { _formCallbacks.version = i; _form = NativeMethods.FPDFDOC_InitFormFillEnvironment(_document, _formCallbacks); if (_form != IntPtr.Zero) { break; } } NativeMethods.FPDF_SetFormFieldHighlightColor(_form, 0, 0xFFE4DD); NativeMethods.FPDF_SetFormFieldHighlightAlpha(_form, 100); NativeMethods.FORM_DoDocumentJSAction(_form); NativeMethods.FORM_DoDocumentOpenAction(_form); Bookmarks = new PdfBookmarkCollection(); LoadBookmarks(Bookmarks, NativeMethods.FPDF_BookmarkGetFirstChild(document, IntPtr.Zero)); }
protected void LoadDocument(IntPtr document) { _document = document; NativeMethods.FPDF_GetDocPermissions(_document); _formCallbacks = new NativeMethods.FPDF_FORMFILLINFO(); _formCallbacksHandle = GCHandle.Alloc(_formCallbacks); _formCallbacks.version = 1; _form = NativeMethods.FPDFDOC_InitFormFillEnvironment(_document, ref _formCallbacks); NativeMethods.FPDF_SetFormFieldHighlightColor(_form, 0, 0xFFE4DD); NativeMethods.FPDF_SetFormFieldHighlightAlpha(_form, 100); NativeMethods.FORM_DoDocumentJSAction(_form); NativeMethods.FORM_DoDocumentOpenAction(_form); }
protected void LoadDocument(IntPtr document) { _document = document; NativeMethods.FPDF_GetDocPermissions(_document); _formCallbacks = new NativeMethods.FPDF_FORMFILLINFO(); _formCallbacksHandle = GCHandle.Alloc(_formCallbacks); _formCallbacks.version = 1; _form = NativeMethods.FPDFDOC_InitFormFillEnvironment(_document, ref _formCallbacks); NativeMethods.FPDF_SetFormFieldHighlightColor(_form, 0, 0xFFE4DD); NativeMethods.FPDF_SetFormFieldHighlightAlpha(_form, 100); NativeMethods.FORM_DoDocumentJSAction(_form); NativeMethods.FORM_DoDocumentOpenAction(_form); Bookmarks = new PdfBookmarks(_document); }