4

I am working on a web application using asp.net.

One of requirements demands that I open a given pdf file containing form fields, fill the fields like checking the check boxes, selecting the values from the select inputs and entering the text in text boxes etc.

Once the fields are set then I need to submit it to server and save this as a new pdf file or update the same pdf file.

I don't have a submit button in the pdf itself. I need to submit the details to server using a button outside the pdf file.

meskobalazs
  • 15,741
  • 2
  • 40
  • 63
Javid Ahmad
  • 51
  • 1
  • 5
  • Without including code, this cannot be answered. As of now, I am voting for a close. – meskobalazs Aug 08 '15 at 11:11
  • 1
    @meskobalazs The question can be answered in the sense that explaining that what is asked is impossible is also an answer. The requirement *I need to submit the details to server using a button outside the pdf file* is impossible is the application needs to work on a Mac or if it needs to work with viewers other than Adobe Reader. – Bruno Lowagie Aug 08 '15 at 11:34
  • I should have elaborated: the questions is too vague. Potential answers IMHO need to many guesswork, which would not be necessary with a better description. – meskobalazs Aug 08 '15 at 11:38

1 Answers1

2

When you have a file on a server and you serve it to a client, there are two instances of the file: one on the server and one on the client.

The end user can fill out the form on the client, but will need a button on the PDF if you want him to submit the data he entered to the server. This is explained here: Edit pdf embedded in the browser and save the pdf directly to server

Your requirement to have a button outside the PDF is in most cases impossible: it requires establishing communication between the PDF viewer and the browser. This is only possible in a very specific environment: it requires the Adobe Reader plug-in and it won't ever work on Mac. See also PDF hostContainer callback

You need to reconsider the requirement of having a button outside the PDF! I've been working on a similar project where the submit button was added to the form on-the-fly. The button was only visible on the PDF on the client. The client used that button to submit the data.

Once the data is submitted (see Edit pdf embedded in the browser and save the pdf directly to server to find out in which form the data can be transmitted), you can fill out the form on the server-side. This is explained here:

The form on your server is your template. I assume that this template will be served to many different people. If that is true, then you do not want to replace that template with a form that is filled out by the previous user! (This code cause some serious privacy issues.)

If you really want to update the PDF that exists on the server (instead of creating a new copy), you might also want to read the answer to this question: How to update a PDF without creating a new PDF?

Community
  • 1
  • 1
Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165