chinapandaman / PyPDFForm

:fire: The Python library for PDF forms.
https://chinapandaman.github.io/PyPDFForm/
MIT License
438 stars 19 forks source link

PPF-707: text field aligned to center #707

Open vatsenko opened 3 months ago

vatsenko commented 3 months ago

Version

PyPDFForm=1.4.31

Issue Description

Need to create text field aligned to center (optionally right)

Code Snippet

new_form.create_widget(
        widget_type="text",
        name=id,
        page_number=1,
        x=x,
        y=y,
        width=w,  # optional
        height=h,  # optional
        #max_length=5,   # optional
        #font="Arial Narrow", # optional
        font_size=f,   # optional
        #font_color=(1, 0, 0),   # optional
        #bg_color=(0, 0, 1), # optional
        #border_color=(1, 1, 1), # optional
        border_width=0  # optional
        text_align="C"
    )

PDF Form Template

filled.pdf

Screenshots (if applicable)

Screenshot 2024-08-17 at 23 53 58
chinapandaman commented 3 months ago

Hey thanks for posting. This is implemented in the newest version. Give v1.4.32 a try and let me know.

chinapandaman commented 3 months ago

Forgot to mention, the doc for this is also updated: https://chinapandaman.github.io/PyPDFForm/prepare/#create-a-text-field-widget