Submitting PDF to a servlet

I have written a simple servlet which writes the submitted pdf to the c drive of the server. I have written the instructions in the pdf document which can be found here
Click here to access the pdf
Download the war file
Deploy it on your server
Design your form with a submit button configured to submit “PDF” and pointing to the url
The url should be of the following format
in my case it was http://ginger:8080/SaveToFile/SavePdf. Where ginger:8080 is my server and port no.
Save the form and hit the submit button
The form will get submitted to the servlet which writes the pdf to the c drive of the server
Let me know if you need any more help


37 responses to “Submitting PDF to a servlet

  1. Hi, i think this should be usefull but in order to have the path to our server folder is needed more than a hosting service contract?
    Do we need a dedicated server or some housing service?

    • Hi Luca
      yes you will need a tomcat server, it is free and can be easily set up
      let me know if you need any more help

  2. Luca.. of course u need to have a host and plenty other things..
    I remember when i first asked this question and didnt know what i was getting myself into..
    This is a very good tool Only one thing missing, u have to know how to create a DB from scratch. If u cannot.. You are stuck!!! As the servelet needs something to submit to.
    Which leads to my next question.
    1. I know u can submit a pdf via email (lets hold that thought.)
    2. I know i can submit a pdf via servlet( req. php and db knowlege)
    3. Now lets say im a dummy.. or lets just say i have a form with approx 300 fields. And idk how to make a db for it. How can i submit it to anythin.

    I hope i havent lost u yet.??

    OKay reason i ask is this.. Form a is filled out by you.. u hit submit.!
    It submits to <–using outlook.
    On that computer that is hosting that email, it is using outlook express and has LC ES 8.2 and Adbobe 9.. but no one uses that computer. So there is no one to say download the info on the email to adobe or LC db… am i making sense.?
    Basically. i dont think email will work.. cause no one uses that pc. it sits by itself.

    • Hi Junior
      Do you want to store the submitted pdf to the DB? If that is the case it is very easy, all you need to do is create a simple DB(mySql is great). In that DB create a table and in that table create a column of type BLOB. This column will store the pdf file. If you are in the US, I can walk you through the steps involved in this
      let me know

  3. i am in the US… Houston TX to be exact.. . I have My Sql.. I know how to load a DB.. i just dunno how to create one from scratch….

  4. and yea.. im trying to store thee submitted PDF to DB… thnx.

  5. im up right now.. and im gonna stay up to about 430am my time.. im waiting on u to come online.
    As it seems u come online at around 4ish my time everytime.

  6. Umm… hello. im still needing ur help.

  7. We are attempting to do the same thing, except using PHP on the backend. Strange thing is, we can get it to “work” (as in, the Adobe Reader submits -something-), but on the PHP side the “POST” variables ($_GET, $_POST, $_REQUEST, $_FILES) are empty. Adobe Reader is obviously posting something to the PHP script though, as it is running (I am echoing the those variables above to a text file on the server). Not sure where or what is happenning to the file…

  8. Can you send me your WAR file w/ source code? I cant find examples of this anyplace… thank you

  9. hi,

    If I submit a pdf form to a server using http post and say the server is sending back a response flag, is there any way to process that response within the pdf?


  10. This is great! It’s simple and clean. I wasn’t sure what to do with the file tho.. Is there someway to send the file to a network folder or smtp the file to someone?

  11. Hi Girish,

    Thanks for your useful sample. But is there a way to pass a parameter to the servlet also? For example, I have the following servlet url with a parameter in the “Submit to URL” field “http://localhost:8080/RegistrationRequestWeb/ProcessPDFServlet?para1=paraValue”.

    However, I don’t want to hardcode the paraValue, but to pull the paraValue from one of the fields in my pdf. Do you know if there’s a way to do that? Thank you Girish.


    • Girish Bedekar

      I will get back to you on this, or you can parse the data and get the field value in the servlet

  12. I cannot get this example to work right..

    I deploy the .war file in tomcat server. But then am I supposed to copy/paste the file into the new SavetoFile folder that’s created? I’m using XAMPP right now to launch this.

    Also I am modifying the submit button URL in LiveCycle, reopening and extending Usage Rights to Reader in Acrobat, then am opening it in Reader to submit the form. Is this the right way to do it?

    • you deploy the file on the server and create a pdf with a submit button and make sure the url in the submit button is pointing to http::/SaveToFile/SavePDF
      then open the pdf file in acrobat and hit the submit
      the file should get written to your c drive
      let me know if you have any more questions

  13. hiii Girish
    Thanks for your Example.
    I have some queries.
    Is this possible to save a fillable pdf on client m/c , where they have only adobe reader (that can be a free version also).
    My requirement is like client should able to save a form after filling (after saving form it can be static one.)
    Can this possible


  14. Hiii Girish
    Thank 4 your example.
    But it is not working , when i open pdf using adobe reader 8
    Does it have any version problem??

  15. Hi Girish,

    Thanks for the example, but now I have a problem, can the pdf filename can be change rather than static, because if the pdf is upload to the server, it only able to allow ONE user to submit the data into servlet, the next person submit will overwrite the previous person data. Please kindly advice.

    • Girish Bedekar

      Yes, you will have to write that logic in the servlet to change to name of the file. Try appending a number to the filename to make it unique

      • Hi Girish,

        Can you please let me know if it is possible to create an online submit button in Adobe Acrobat/Lifecycle Designer for people to fillit and send it over to an email address

  16. Hi, could someone help me with auto populating fields from MS access please?

  17. Hello,

    Very nice and useful example. if i send a pdf to the servlet with attachments, am i able to save them separated?and one more question, can i send two parameters from the pdf in a submit button?

    Thanks in advance

    • To be able to save the pdf attachments on the server side- using livecycle server it is very easy. I am not sure of doing it without using livecycle server.
      I am not sure what you mean “sending 2 parameters” in the pdf submit button. Can you please elaborate?

      • Gonçalo Miranda

        The thing is i am not allowed to user Forms service, so i want send to a servlet two things: the pdf itself and the xml data. As the pdf can have files attached, how can i extract them using pure java code (and not the forms library) ?
        i heard that to do that i have to call my servlet two times but no idea in what relates to extract attachments.


  18. Hi Girish
    Can you please help on this ?
    I want to get the GPS Cooridates / data on a Livecycle PDF form.
    Is there is any method on JS which can do this for me ??

    Any Idea or suggestion would be highly appreciated


  19. could anyone help me where is this war file ?

  20. Hi! I really nedd this servlet but.. where I can find it? I don’t find the code!!


  21. I receive the pdf from an externat office… i need LiveCycle on the server(linux)??
    the only thing that i can do now is to get the bufferedreader from my servlet and to read something like this:


  22. please help me!

  23. Hi Stefano
    If you have livecycle server, I can help you. Since my servlet depends on livecycle libraries. Without livecycle I am sorry my servlet will not work

  24. hi, I can’t seem to find the WAR file to download, can you help?

  25. Hi Girish,
    I have a LiveCycle Form with a submit button. When the submit button is clicked the data is submitted on HTTPS to our application.
    It works fine when the form is opened in Adobe Reader, Adobe Pro or from with in a Browser on Windows, On Windows Platform no issues!

    On a MAC computer, the same form works fine when its opened in Safari Browser and submitted.

    But on a MAC computer if the form is opened in Adobe Reader DC and then the submit button is clicked. We get an error message saying that “An error occurred during the submit process. There was a problem connecting to the server.”. The funny thing is that data is actually transferred, but since the user get this message they think the form submission failed and then they try again and again and we end up with a bunch of duplicates submission.

    I think the send portion work but the receiving the response portion fails.

    When the form is submitted, we acknowledge the submission and we return a HTML document as the response to this submission.

    Any Ideas as to why the form submission/response does not work on MAC with Adobe Reader DC version.

    Any help is much appreciated.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s