-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG TextField objects are not editable when added to an existing PDF #138
Comments
I think I can spot the problem (although I may be wrong). You are adding the same TextField to every Page. For other LayoutElement objects this wouldn't matter. But FormField objects are special. If you want 5 TextFields, you have to create 5 separate TextFields. Can you change your code to try out this idea? Just move the line where you construct the TextField inside the loop. Kind regards, |
Hi Joris, It doesn't do the trick :( with open("crf_textfield.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),
)
for i in range(0, N):
page = doc.get_page(i)
TextField(field_name=f"subject_id_{i}").paint(page, r)
with open("borbtest.pdf", "wb") as pdf_out_handle:
PDF.dumps(pdf_out_handle, doc) I extracted 5 pages for these tests so I can share the input file: crf_textfield.pdf The output file I got is this one: borbtest.pdf |
I made the test even simpler by taking just the first It seems like your PDF is applying some kind of strange coordinate-transform. The rectangle for the I'm guessing the same problem manifests itself in the larger PDF. And perhaps because you are drawing so close to the boundary of the |
Hi Joris, Thank you for investigating this. I'm not sure if I have many options to address the issue then, because I don't have much control in how the PDF is built. The thing is that a colleague did this "manually" using Acrobat pro, so I thought of doing it programatically. Thanks again |
Simon, I was experiencing a similar issue: for some reason the PDF that I was developing is placing the Text_Field object in the correct place, but performing a linear shift to the coordinates when printing the border for the Text_Field object. A particularly weird aspect of this is that this problem only appeared after I updated to the current version. I'm not sure if this is useful information to you, but since the borders for the boxes are not necessary for my document, I just set the border_**** parameters to False for the Text_Field objects. -- Michael |
Describe the bug
TextField objects that are added to existing PDF pages with absolute positioning are displayed, but not editable.
To Reproduce
paint
method.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.
Screenshots
Desktop (please complete the following information):
Additional context
The aim is to add an input text field to enter the subject ID and carry it over all pages before printing.
The text was updated successfully, but these errors were encountered: