-
-
Notifications
You must be signed in to change notification settings - Fork 148
Open
Description
Describe the bug
TextField objects that are added to existing PDF pages with absolute positioning are displayed, but not editable.
To Reproduce
- Open an existing PDF.
- Iterate the document pages and add TextField objects to a specific position with
paint
method. - Save document as a new PDF
from borb.pdf import Document
from borb.pdf import PDF
from borb.pdf.canvas.geometry.rectangle import Rectangle
from decimal import Decimal
from borb.pdf import Page
from borb.pdf import Paragraph
from borb.pdf import TextField
with open("questionnaire.pdf", "rb") as in_file_handle:
doc = PDF.loads(in_file_handle)
info = doc.get_document_info()
N = int(info.get_number_of_pages())
r: Rectangle = Rectangle(
Decimal(50),
Decimal(5),
Decimal(100),
Decimal(5),
)
subfield = TextField(field_name="subject_id")
for i in range(0, N):
page = doc.get_page(i)
subfield.paint(page, r)
with open("borbtest.pdf", "wb") as pdf_out_handle:
PDF.dumps(pdf_out_handle, doc)
Expected behaviour
The TextField object should be editable in the output PDF.
The aim is that entering text in any of the pages updates all text fields. That is why I'm using one TextField object for all pages. I'm unsure if this is the right approach or possible at all.
Desktop (please complete the following information):
- OS: Mac OSX 12.6
- borb version: 2.1.5.2
- The input PDF is a Clinical Research Form and should not be shared because it includes licensed clinical tests.
Additional context
The aim is to add an input text field to enter the subject ID and carry it over all pages before printing.
Metadata
Metadata
Assignees
Labels
No labels