title: Trigger javascript function or event inside a PDF
body: <p>I'm trying to fill a <code>XFA PDF</code> using <code>JavaScript</code>/<code>Java</code>. The PDF is not made by me; I need to download it, fill it and upload back.</p>
  <p>The PDF has a button for Import XML which does the work just fine, but I want to do it programmatically for my clients.</p>
  <p>Is there any way to execute a JavaScript function inside the PDF or trigger the button event? I've tried to embed the <code>XML</code> as an attachment, but it doesn't trigger anything and the data is unchanged…</p>
  <p>The PDF can be found here: <a href="https://mfinante.gov.ro/documents/2552173/2552377/02_F1103_Buget_individual_2022_07_07_A2.0.125.pdf/ee988bfb-b7bc-8774-29b5-95b0dc94df7e?t=1657200566548" rel="nofollow noreferrer">https://mfinante.gov.ro/documents/2552173/2552377/02_F1103_Buget_individual_2022_07_07_A2.0.125.pdf/ee988bfb-b7bc-8774-29b5-95b0dc94df7e?t=1657200566548</a></p>
  <p>And a XML example would be:</p>
  <pre><code>&lt;f1103 d_rec=&quot;0&quot; suma_control=&quot;18332934&quot; luna_r=&quot;01&quot; an=&quot;2025&quot; nume_ip=&quot;dsadsadasd&quot; cui_ip=&quot;17460640&quot; special=&quot;0&quot; tip_bug=&quot;I&quot; an_apr=&quot;2025&quot;&gt;
      &lt;f1103_buget cod_sec_bug=&quot;02&quot; cod_prog_bug=&quot;0000000000&quot; cod_sfin=&quot;A&quot; sect=&quot;F&quot;&gt;
          &lt;f1103_indicator cf_cap=&quot;11&quot; cf_scap=&quot;05&quot; cf_par=&quot;00&quot; ce_titlu=&quot;00&quot; ce_art=&quot;00&quot; ce_alin=&quot;00&quot; cb_an_0=&quot;12312&quot; cb_an_1=&quot;124124&quot; cb_an_2=&quot;423423&quot; cb_an_3=&quot;123&quot; cb_an_ult=&quot;312312&quot; ca_an_0=&quot;0&quot; limita_ca_an_0=&quot;0&quot;/&gt;
      &lt;/f1103_buget&gt;
  &lt;/f1103&gt;
  </code></pre>