Skip to content

Editing properties of a field #2559

Closed as not planned
Closed as not planned
@ReedGraff

Description

@ReedGraff

Explanation

I'd love to be able to change field properties. Specifically, in Adobe, it is possible to change the background color of a signature field to yellow, red, or another color for example. If someone could point me in the right direction I would happily make this myself.

image
image

Code Example

I assume this could be done two ways, by extending or appending functionality to the update_ function, or by creating a new function in its entirety. The latter of which is probably easier.

from pypdf import PdfReader, PdfWriter

reader = PdfReader("SOMEPATH")
writer = PdfWriter()
writer.append(reader)

for page in range(len(reader.pages)):
    writer.update_page_form_field_properties(
    writer.pages[page],
    {
          'field1': {"background": "#ffffff", "font": "Helvetica"}, 
          'field2': {"fontSize": "14pt", "color": "#000000"},
    }
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    workflow-formsFrom a users perspective, forms is the affected feature/workflow

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions