You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a script to automatically fill out some paperwork I have to do for my day job. I'm trying to scale it to share with my coworkers by using an AWS lambda function and s3 database. The issue is that although the code successfully fills out the PDF on my local implementation, it only fills out one field on AWS.
I use the try-except block to call update_page_form_field_values because I otherwise run into the following issue:
{
"errorMessage": "'/DA'",
"errorType": "KeyError",
"requestId": "fa672967-1642-4805-8754-19520721d2b7",
"stackTrace": [
" File \"/var/task/lambda_function.py\", line 45, in lambda_handler\n body += \"lien is located in \" + data_json[\"state\"] + \": \" + process_state(data_json[\"state\"])\n",
" File \"/var/task/lambda_function.py\", line 22, in process_state\n return action()\n",
" File \"/var/task/lambda_function.py\", line 13, in <lambda>\n 'NM': lambda: fill_pdf(\"New Mexico\"), # TODO: add parameters to this call\n",
" File \"/var/task/fill_pdf.py\", line 105, in fill_pdf\n write_file(state, pdf, data)\n",
" File \"/var/task/fill_pdf.py\", line 84, in write_file\n writer.update_page_form_field_values(\n",
" File \"/opt/python/pypdf/_writer.py\", line 973, in update_page_form_field_values\n self._update_text_field(writer_annot)\n",
" File \"/opt/python/pypdf/_writer.py\", line 840, in _update_text_field\n cast(str, field[AA.DA]).replace(\"\\n\", \"\").replace(\"\\r\", \"\").split(\"\")\n",
" File \"/opt/python/pypdf/generic/_data_structures.py\", line 309, in __getitem__\n return dict.__getitem__(self, key).get_object()\n"
]
}
Nevertheless, my console prints "Error in updating form field: "'/DA'" and only one field of the form is filled out. When I print out the fields JSON, there is no '/DA' entry, even in the one field that is successfully filled out. I'm not entirely sure what the bug is, b ut how can it be that the code works locally but not as a Lambda?
The text was updated successfully, but these errors were encountered:
I am developing a script to automatically fill out some paperwork I have to do for my day job. I'm trying to scale it to share with my coworkers by using an AWS lambda function and s3 database. The issue is that although the code successfully fills out the PDF on my local implementation, it only fills out one field on AWS.
Code + PDF
Local Code which works
AWS Code which seems to not work
I use the try-except block to call
update_page_form_field_values
because I otherwise run into the following issue:Nevertheless, my console prints
"Error in updating form field: "'/DA'"
and only one field of the form is filled out. When I print out the fields JSON, there is no '/DA' entry, even in the one field that is successfully filled out. I'm not entirely sure what the bug is, b ut how can it be that the code works locally but not as a Lambda?The text was updated successfully, but these errors were encountered: