Search code examples
phpacrobatxfdf

Acrobat pdf importAnXFDF from external sources


I have created a pdf form using acrobat with below script.

Below the script:

function importXFDF() {
    var url = "https://<Server>/first-form_data.xfdf";
    this.importAnXFDF(url);
}
importXFDF();

If any users download and open the form i am trying to Prefill the form values from XFDF file using importAnXFDF() function. XFDF file is dynamically created by php script.

The issue is: if i pass any local xfdf file then the values are populated. But it fails if it is server file. Is it possible to import data to pdf form from server?


Solution

  • You can't import an XFDF from a URL, only from a local file path. Instead, create an FDF file on your server then in your form, use submitForm where the URL is the URL to your server plus "#FDF". Thi will tell Acrobat to expect an FDF to be returned. Return the FDF using application/vnd.fdf as the mime type. Acrobat should populate the values.