Skip to content

Add a visual multi-page editor for PdfLetter fields#2

Draft
gabrielsolomon with Copilot wants to merge 2 commits into
masterfrom
copilot/create-visual-editor-for-pdf-letters
Draft

Add a visual multi-page editor for PdfLetter fields#2
gabrielsolomon with Copilot wants to merge 2 commits into
masterfrom
copilot/create-visual-editor-for-pdf-letters

Conversation

Copilot AI commented Jul 6, 2026

Copy link
Copy Markdown

This introduces a visual editor for PdfLetter field placement so fields can be added, removed, and adjusted directly against the source PDF. It also exposes multi-page positioning and field inventory data needed to manage repeated merge fields from a single UI.

  • Editor payload and field persistence

    • Added editor-facing serialization on PdfLetterTrait for:
      • PDF page dimensions
      • embedded PDF preview source
      • existing placed fields
      • available merge fields with placement counts
    • Added field sync support to create, update, and delete editor-managed fields in one request.
  • Per-page field positioning

    • Extended FieldTrait with explicit page metadata, editor serialization, and editor input normalization.
    • Preserved compatibility with existing absolute-Y positioning by inferring page from legacy coordinates when page metadata is absent.
    • Updated PDF rendering helpers and writers to honor explicit page selection for text and barcode fields.
  • Visual editor surface

    • Added PdfLetterFieldsEditorControllerTrait with endpoints for:
      • rendering the editor
      • loading editor data
      • saving field layouts
    • Added library-provided editor template, CSS, and JS assets for:
      • field palette/sidebar
      • per-page canvas overlays
      • drag-based placement
      • inline property editing
      • field removal and layout save
  • Field editing model

    • Extended admin field form support with page input alongside existing size, color, align, and transform controls.
    • Normalized editor color input to the storage format already used by PDF rendering.
  • Example of the new editor contract

    $payload = $letter->getEditorPayload();
    
    // pages, preview source, placed fields, and available merge fields
    $fields = $letter->syncEditorFields($request['fields']);
  • Behavioral coverage

    • Added tests for page inference, editor coordinate normalization, and explicit-page PDF Y-position handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants