@@ -1728,6 +1728,32 @@ def test_update_form_fields2(caplog):
17281728 assert "Text string 'شهرزاد' contains characters not supported by font encoding." in caplog .text
17291729
17301730
1731+ @pytest .mark .enable_socket
1732+ def test_update_form_fields3 ():
1733+ url = "https://github.com/user-attachments/files/21073581/CERERE.INMATRICULARE.form.pdf"
1734+ name = "iss3361.pdf"
1735+ writer = PdfWriter ()
1736+ writer .append (BytesIO (get_data_from_url (url , name = name )))
1737+ data = {
1738+ "subsemnatul" : "Σὲ γνωρίζω ἀπὸ τὴν κόψη" ,
1739+ "strada" : "Căpitan Nicolae Licăreț" ,
1740+ "adresa_judet" : "Конференция" ,
1741+ }
1742+ writer .update_page_form_field_values (writer .pages [0 ], data , auto_regenerate = False )
1743+ apstream_object = (writer .pages [0 ]["/Annots" ][0 ]["/AP" ]["/N" ].get_data ())
1744+ found_hex = re .findall (r"<(.*?)>" , apstream_object .decode ())
1745+ expected_hex = data ["subsemnatul" ].encode ("utf-16-be" ).hex ()
1746+ assert expected_hex in found_hex
1747+ apstream_object = (writer .pages [0 ]["/Annots" ][7 ]["/AP" ]["/N" ].get_data ())
1748+ found_hex = re .findall (r"<(.*?)>" , apstream_object .decode ())
1749+ expected_hex = data ["strada" ].encode ("utf-16-be" ).hex ()
1750+ assert expected_hex in found_hex
1751+ apstream_object = (writer .pages [0 ]["/Annots" ][9 ]["/AP" ]["/N" ].get_data ())
1752+ found_hex = re .findall (r"<(.*?)>" , apstream_object .decode ())
1753+ expected_hex = data ["adresa_judet" ].encode ("utf-16-be" ).hex ()
1754+ assert expected_hex in found_hex
1755+
1756+
17311757@pytest .mark .enable_socket
17321758def test_iss1862 ():
17331759 # The file here has "/B" entry to define the font in a object below the page
0 commit comments