ajrcarey / pdfium-render

A high-level idiomatic Rust wrapper around Pdfium, the C++ PDF library used by the Google Chromium project.
https://crates.io/crates/pdfium-render
Other
364 stars 59 forks source link

Add support for reading form field values. #76

Closed ajrcarey closed 1 year ago

ajrcarey commented 1 year ago

Form fields in Pdfium are handled as page annotations, specifically annotations of type FPDF_ANNOT_WIDGET or FPDF_ANNOT_XFAWIDGET (depending on whether the embedded form is an Xfa or non-Xfa form). A subset of FPDFAnnot_* functions handle retrieving form field properties for these annotation types.

Add support for form fields and retrieving user-set values of form fields to pdfium-render.

ajrcarey commented 1 year ago

Added new PdfFormField enum. Renamed PdfPageObjectFormFragment to PdfPageXObjectFormObject to disambiguate it from PdfForm and PdfFormField, and PdfFormFields. Added PdfPageAnnotationCommon::as_form_field() accessor function. Added form field structs PdfFormPushButtonField, PdfFormCheckboxField, PdfFormComboBoxField, PdfFormListBoxField, PdfFormRadioButtonField, PdfFormSignatureField, PdfFormTextField, and PdfFormUnknownField. Added PdfFormFieldOption struct and PdfFormFieldOptions collection for retrieving the options displayed within a list box or combo box field. Added PdfFormFieldCommon and PdfFormFieldPrivate traits and associated implementations. Added the PdfForm::field_values() convenience function for retrieving all field names and values in a single operation. Added examples/form_fields.rs example. Updated READMEs. Bumped crate version to 0.7.34.