Skip to content

PPF-1156: Extend PyPDFForm to Inspect Adobe Form Data #1156

@flywire

Description

@flywire

Version

PyPDFForm=3.4.0

Issue Description

Returning fill data from (inspecting) Adobe pdf forms. Using https://chinapandaman.github.io/PyPDFForm/inspect/#inspect-pdf-form-data.

Note: Fill data is available in following snippet as T E S T N A M E (ie one space between characters, two spaces between words).

Code Snippet

Microsoft Windows [Version 10.0.26100.4946]
(c) Microsoft Corporation. All rights reserved.

E:\00>python
Python 3.13.1 (tags/v3.13.1:0671451, Dec  3 2024, 19:06:28) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymupdf
>>>
>>> pdf_file = 'Adobe-sample_template.pdf'
>>> doc = pymupdf.open(pdf_file)
>>>
>>> for page in doc:
...     text_blocks = page.get_text("dict", flags=pymupdf.TEXTFLAGS_TEXT)["blocks"]
...     for block in text_blocks:
...         for line in block["lines"]:
...             for span in line["spans"]:
...                 text = span["text"]
...                 color = pymupdf.sRGB_to_rgb(span["color"])
...                 if color ==  (0, 0, 0):
...                     print(f"Text: {text}, Color: {color}")
...
Text: T E S T  N A M E, Color: (0, 0, 0)
>>>

PDF Form Template

Adobe-sample_template.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions