0

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.

kyall
  • 403
  • 1
  • 3
  • 11
  • Not sure if you can do that as the URL it submits to is embedded in the PDF. [refrence](http://www.w3.org/TR/WCAG-TECHS/PDF15.html) – sachleen Nov 04 '12 at 04:17
  • Not an answer (I don't know if or how it would be done), just a tip. In situations similar to the one you describe, I make a point of asking the client what advantages their system offers, 'so I can make a point of preserving and enhancing them' Often times this can be a good way of opening a dialogue that can illustrate the actual or perceived strengths of the stipulated platform/method. When the strengths can be shown to be perceived only, there may be a good case for change. Mentioning the price differential in the two methods is another good tactic. – enhzflep Nov 04 '12 at 04:20
  • Do you have the opportunity to modify the PDF programmatically on the server? E.g. as a response to a client requesting the PDF form from the server? If yes, what is your server-side development environment? Java, .NET, etc.? – Frank Rem Nov 04 '12 at 09:29

1 Answers1

1

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'.
Community
  • 1
  • 1
Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165