Copy link to clipboard
Copied
I m planning to add five smilies from sad to happy to the bottom of our invoices to measure user satisfaction. User can choose to submit the chosen one with a button. I want to send this data -which is a number from 1 to 5- to a web server to process.
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "https://mywebservice.asp", true);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.send(newdata);
Newdata is the number from 1 to 5 mentioned above.
Right now I m opening .pdf files in Firefox browser and getting below error.
ReferenceError: XMLHttpRequest is not defined
send@resource://pdf.js/build/pdf.scripting.js line 70 > eval:4:13
@Resource://pdf.js/build/pdf.scripting.js line 70 > eval:9:1
globalEval@resource://pdf.js/build/pdf.scripting.js:70:41
_runActions@resource://pdf.js/build/pdf.scripting.js:3100:14
_dispatchDocEvent@resource://pdf.js/build/pdf.scripting.js:3067:16
dispatch@resource://pdf.js/build/pdf.scripting.js:2613:28
_dispatchEvent@resource://pdf.js/build/pdf.scripting.js:2025:27
__webpack_modules__</initSandbox/<@resource://pdf.js/build/pdf.scripting.js:254:22
Copy link to clipboard
Copied
- Firefox is not a PDF reader, it's a browser which, like the others, does not respect all the specifications of the PDF format.
- Answer is yes and yes.
See these tutos:
https://acrobatusers.com/tutorials/form-submit-e-mail-demystified/
https://acrobatusers.com/tutorials/print/submitting-data/
https://khkonsulting.com/2017/08/connect-database-pdf-form-time-without-soap/
Acrobate du PDF, InDesigner et Photoshoptographe
Copy link to clipboard
Copied
@JR BoulayCan you please take a look to above question if you have some time?
For now, I just d like to know if you can use forms in a PDF document that can submit data to webservice or create HTTP object with JS that submitts data. In the above code newdata contains e.g.: {"score":3}
The feedback form would look like this:
Highlighting the emojis onhover and set newdata value onclick is a next to do..
Copy link to clipboard
Copied
The browser doesn't use Adobe Acrobat.
What happens when you open the file in Adobe Acrobat?
Copy link to clipboard
Copied
I tried in Adobe Acrobat but nothing happened.
Firefox is my default app for opening files with .pdf extension and if it s just a simple .pdf file it opens it without any issues.
Copy link to clipboard
Copied
Sure, but it (Firefox) does not use any Adobe tech. If you have problem with PDF in Firefox, you need to ask Firefox. Firefox are one of many RIVALS to Adobe in PDF.
We can help you look at problem with Acrobat Pro and JavaScript. What do you see in the JavaScript debugger after "nothing happened"?
Copy link to clipboard
Copied
Sure, sorry for posting FF debug.
Adobe Pro JS debug:
Console:
Exception in line 5 of function send, script Document-Level:send
Exception in line 10 of function top_level, script Document-Level:send
ReferenceError: XMLHttpRequest is not defined
5:Document-Level:send
Script:
function send()
Is Acrobat JS able to define XMLHttpRequest object in a PDF document?
{
var newdata = {};
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "https://mywebservice.asp", true);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.send(newdata);
}
send();
Copy link to clipboard
Copied
function send()
{
var newdata = {};
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "https://mywebservice.asp", true);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.send(newdata);
}
send();
Copy link to clipboard
Copied
- Firefox is not a PDF reader, it's a browser which, like the others, does not respect all the specifications of the PDF format.
- Answer is yes and yes.
See these tutos:
https://acrobatusers.com/tutorials/form-submit-e-mail-demystified/
https://acrobatusers.com/tutorials/print/submitting-data/
https://khkonsulting.com/2017/08/connect-database-pdf-form-time-without-soap/
Acrobate du PDF, InDesigner et Photoshoptographe
Copy link to clipboard
Copied
This is what I was looking for:
https://acrobatusers.com/tutorials/print/submitting-data/
Thank you.
I ve a lot to read yet..

