Question

I was working on converting PDF to HTML but the client wouldn't have it. So here we go. I need a way to tell an inlined pdf form to submit POST to a url. Something or other like:

<!-- Inlined PDF --> 
<object type="application/pdf" data="http://xxxxxxx" id="pdf_form"> 
</object> 

<!-- Button I add to the page to do a form submit --> 
<input type="button" onclick="javascript: DoSubmit();"> 

<script type="text/javascript"> 
// Do a POST with the form data here.  Either getting the data out of the pdf 
// or using ACROBAT's FDF export & http submit to handle this 
function DoSubmit() {
  // Get 'pdf_form' and tell it to post it's data to a url  
} 
</script> 

I need it to work this way to the client doesn't have to add a submit button to the pdf whenever they want to add a new form. I'm trying to make the system pretty flexible for adding these forms in; because there are a lot of them.

Best bet is if I don't need to modify the pdfs manually to get this working.

There's also a toolbar that comes up that includes a save button on it. Removing that save button or making that save button do a form submit rather than a pdf file save is also important.

No correct solution

OTHER TIPS

I have good news and I have bad news.

Let's start with the good news as there is fewer of that: You can use JavaScript in PDF just like you can use JavaScript in HTML.

The bad news:

  1. you'll need adapt your PDF to establish a communication between the JavaScript in the PDF and the JavaScript in the HTML. Take a look at an excerpt of my book to find out how to do this. From the HTML, you can trigger a method postMessage(), but this message will only be understood by the PDF if the PDF contains a MessageHandler.
  2. It's a known issue that this doesn't work on every OS (last time I checked, it didn't work on MacOS).
  3. Adobe Reader shows a toolbar that allows people to save a PDF. There is no way to remove that toolbar. I've already answered this question on stackoverflow: Can I hide the Adobe floating toolbar when showing a PDF in browser? Note that the other answer refers to 'Open Parameters'. As far as I know, these parameters can make the upper toolbar in the plug-in visible/invisible, but they have no effect on the 'floating toolbar'.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top