1

I have a situation where I need to fill out a PDF form and then press a button in it (I need to press "Send" button and this sends the data to the system). From what I understand, pressing the button executes a JavaScript script on the form.

I'm using PyMUPDF and filling out the form is not a problem. The problem comes, when I want to press the "Send" button at the end. So far I've found absolutely nothing that could help.

I've identified the appropriate widget and it's attributes look as follows:

{'_annot': 'Widget' annotation on page 12 of <path to file>,
 '_text_da': '',
 'border_color': [1.0, 0.0, 0.0],
 'border_dashes': None,
 'border_style': 'Beveled',
 'border_width': 1.0,
 'button_caption': 'Send',
 'choice_values': None,
 'field_display': 0,
 'field_flags': 65536,
 'field_label': '',
 'field_name': 'Mail',
 'field_type': 1,
 'field_type_string': 'Button',
 'field_value': '',
 'fill_color': [0.8117700219154358, 0.1058799996972084, 0.15685999393463135],
 'is_signed': None,
 'parent': <weakproxy at XXXXXXXXto Page at XXXXXXX>,
 'rect': Rect(252.4929962158203, 757.8421020507812, 349.0090026855469, 788.2300415039062),
 _!_ 'script': '\n// Version 12.09.06\r\n\r\nthis.mailFormData();\r\n\r\n\r', _!_
 'script_calc': None,
 'script_change': None,
 'script_format': None,
 'script_stroke': None,
 'text_color': [1.0, 1.0, 1.0],
 'text_font': 'Helv',
 'text_fontsize': 16.0,
 'text_format': 0,
 'text_maxlen': 0,
 'xref': 32}

Is there a way in Python (or other technology) to either interact with the button itself or execute the JS script associated with the button ( marked with "!") while retaining the context?

Big thanks in advance, Jerzy

0 Answers0