Submit pdf form fields to a HTTP POST request

16,539
doc.submitForm(url, false);

or

doc.submitForm( url, null, null, null, null, null, null, null, null, null
                null, null, null, null, null, "HTML" );

submitForm actually takes 23 different parameters, the above is only using 16 of them. And if I miscounted, I'm trying to use the cSubmitAs parameter.

This from the JavaScript API reference, which can be found at... lets see... right here. Enjoy.

PS: "this" is almost universally the document in acrobat events. event.target might be a field or something, but "this" is going to be the document.

PPS: Things like bEmpty, aFields, and various other parameters don't work when bFDF = false.

Share:
16,539
Josjojo
Author by

Josjojo

Updated on June 04, 2022

Comments

  • Josjojo
    Josjojo about 2 years

    I've made a pdf form in Adobe Acrobat. Now I want to make a button that submits the form to a HTTP POST request. I have searched for about 4 hours, but I have not found an example to do this.

    Here I read that it is possible to send the pdf form fields with a HTTP submission, but there's also no example given: http://acrobatusers.com/tutorials/form-submit-e-mail-demystified

    I'm looking for a JavaScript example that I can link to the submit button.

  • scunliffe
    scunliffe almost 13 years
    "...takes 23 different parameters" - wow, that is so, so, so, so,... ...so wrong.
  • Mark Storer
    Mark Storer almost 13 years
    It wasn't MY idea. Allthough calling it with {url: url, cSubmitAs: "HTML"} would have been considerably less painful, in retrospect.
  • Ray Cheng
    Ray Cheng almost 12 years
    I recently tried to do this also, but the submit doesn't work with Foxit free PDF reader. It works fine with Acrobat free reader.
  • Mark Storer
    Mark Storer almost 12 years
    Script support outside of the Acrobat stuff is going to be spotty. They tend to cover the basics fairly well, but anything off the beaten path is a crap shoot at best.
  • Mathijs Flietstra
    Mathijs Flietstra about 11 years
    The bit of JSON in @MarkStorer's comment should be {cURL: url, cSubmitAs: "HTML"}.
  • Jason Swett
    Jason Swett almost 8 years
    Where does doc come from?
  • Marius
    Marius about 5 years
    Instead of doc, I've had more success with a JS method on this.