feat(pdf): add form field detection, fill, and flatten

Adds pdfGetFormFields (lists AcroForm fields with name/type/value) and
pdfFillForm (fills text fields by name, optionally flattens) to
PDFOperations.js, dispatched via 'formFields'/'fillForm' in
executeOperation. pdfFillForm skips unknown/non-text fields per-field
(logs + continues) rather than failing the whole batch, matching the
partial-success precedent set by pdfExtractImages.

Wires a "Fill Form" entry into the PDF editor dialog: selecting a PDF
fetches its fields via a new get-pdf-form-fields/pdf-form-fields IPC
round trip and renders one text input per field, plus a flatten
checkbox, following the same structure as the crop/pageNumbers dialogs.

Amit Haridas
This commit is contained in:
2026-08-23 19:31:33 +05:30
parent 2334ab30ed
commit 44624cd4bf
5 changed files with 397 additions and 0 deletions
+46
View File
@@ -2111,6 +2111,52 @@
</div>
</div>
<!-- Fill Form Section -->
<div id="pdf-fill-form-section" class="pdf-operation-section hidden">
<div class="export-section">
<label>PDF File:</label>
<div class="folder-input-group">
<input
type="text"
id="fill-form-input-path"
placeholder="Select PDF file..."
readonly
/>
<button id="browse-fill-form-input">Browse</button>
</div>
</div>
<div class="export-section">
<label>Form Fields:</label>
<div id="fill-form-fields-list" class="fill-form-fields-list">
<small>Select a PDF with fillable fields to list them here.</small>
</div>
</div>
<div class="export-section">
<label class="checkbox-inline"
><input type="checkbox" id="fill-form-flatten" /> Flatten after fill (makes
fields non-editable)</label
>
</div>
<div class="export-section">
<label class="checkbox-inline"
><input type="checkbox" id="fill-form-overwrite" /> Overwrite original
file</label
>
</div>
<div class="export-section" id="fill-form-saveas-section">
<label>Save As:</label>
<div class="folder-input-group">
<input
type="text"
id="fill-form-output-path"
placeholder="Select save location..."
readonly
/>
<button id="browse-fill-form-output">Save As</button>
</div>
</div>
</div>
<div id="pdf-status-message" class="info-message hidden" aria-live="polite"></div>
<!-- Progress indicator -->