Open
Conversation
Introduce a new setFormFieldState API to PdfEngine/IPdfiumExecutor and Pdfium orchestration. The change wires the method through the orchestrator, remote executor, webworker engine and runner, and implements the behavior in PdfiumNative using PDFium form APIs to apply full widget field snapshots (text, checkbox/radio, combobox/listbox) with proper focus, selection, option selection, error handling and memory management. Also update model types and generated PDFium function bindings to support the new flow, and adjust form plugin code to work with the PdfWidgetAnnoField snapshot.
Add support for PDF form widget annotations: create form fields for WIDGET annotations, populate text-field-specific properties (default appearance, border style, MK border/background colors, and form field flags), and generate form-field appearance streams. Expose helpers to set/get MK colors and a dedicated addTextFieldContent routine. Use a FormFill environment when reading annotations (single page and batch) and pass the form handle into widget readers. Update PDFium JS bindings to include form and MK-related functions (CreateFormField, GenerateFormFieldAP, EPDFAnnot_Set/GetMKColor, etc.). Extend models with optional borderColor/backgroundColor and a PdfAnnotationOf helper type. Also include new plugin-form files and viewer icon assets to support form UI. These changes enable better round-trip handling and rendering of interactive form fields.
Unify annotation color/width properties and switch sidebar property mapping to use tools. Models: PdfWidgetAnnoObject renamed borderColor->strokeColor and backgroundColor->color, added strokeWidth. Pdfium engine now reads/writes strokeColor, color and strokeWidth. Plugin-form and form UI updated to use strokeColor/color/strokeWidth (defaults and rendering). Plugin-annotation tools gained optional labelKey for i18n and many tools updated with labelKey values. The property schema was refactored from subtype-based ANNOTATION_PROPERTIES to TOOL_PROPERTIES keyed by tool id; DynamicSidebar and AnnotationSidebar now resolve properties and titles via tool matching. Added widget-edit UI: icon, sidebar component, UI schema panel, and a command to toggle widget edit (with update to command visibility/behavior). Breaking change: code referencing borderColor/backgroundColor should be migrated to strokeColor/color and may need to handle strokeWidth.
Implement end-to-end checkbox (form field) support: handle CHECKBOX cases when creating/updating widget annotations, add addCheckboxContent to configure border, MK colors, flags and field name, and set form field value for generic fields. Ensure appearances are regenerated using EPDFAnnot_GenerateFormFieldAP in appropriate code paths and call it after forcing focus kill. Add clearMKColor helper and clear MK colors when none provided. Update pdfium vendor bindings/binaries to include new EPDFAnnot and ClearMKColor entries. Also add plugin-form checkbox handler and form-checkbox component and update form renderers/tools and viewer snippet property schema/commands to support checkbox fields.
Add a regenerateWidgetAppearances API and implementation across the engine layers so form widget appearance streams can be regenerated on demand. Changes include: - Models: expose PdfEngine.regenerateWidgetAppearances and IPdfiumExecutor signature. - Orchestrator/Worker/Remote: forward the new request and enqueue/proxy worker tasks. - Pdfium native executor: implement regeneration by calling EPDFAnnot_GenerateFormFieldAP for matching annotation NMs and regenerate page content when any were updated. - PDFium interop & fixes: handle unknown/non-standard fonts by falling back to Helvetica where needed, adjust checkbox/radiobutton checked detection to use the annotation "AS" state, and small cleanup comments/logic tweaks. - Bump pdfium submodule and update autogenerated vendor functions (formatting/typing changes). This enables programmatic refresh of widget appearances after form changes and fixes font/checkbox handling to avoid write failures or incorrect checked state detection.
Remove cached form-fill state from PageContext and introduce withFormHandle to create a fresh form-fill info/handle for each operation. Update engine call sites to use the ephemeral handle (or pageCtx.withFormHandle) and adjust helper signatures (e.g. addTextFieldContent, addCheckboxContent) to accept a formHandle. Consolidates resource management and cleanup (FORM_OnAfter/BeforeClose, PDFiumExt_Exit/Close) into well-scoped try/finally blocks, fixes stale-state risks, and ensures form rendering and annotation reads/writes use a safe, short-lived form-fill environment. Changes affect packages/engines/src/lib/pdfium/cache.ts and packages/engines/src/lib/pdfium/engine.ts.
Implement choice field handling for COMBOBOX and LISTBOX across the stack. Added addChoiceFieldContent() in the Pdfium engine to set appearance (DA), border (BS), MK colors, form field flags (preserving Combo bit 17), field name, options (/Opt array) and default value (/V) with proper WASM memory management. Wire up creation & rendering branches and selection handling (FORM_SetIndexSelected / multi-select list handling). Updated generated PDFium function bindings and bumped the pdfium submodule commit. Also add plugin-form handlers and components (combobox/listbox) and update form renderers, tools and snippet sidebar/commands to support these new field types.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.