I am developing an application that, in a nutshell, handles a PDF form. The submission data format is XFDF. So far, so good, but I'm getting some very strange behavior from the clients.
The PDF viewer is Adobe Reader (currently 11.0.6) in IE. This is an internal application, so there is no need to support anything else right now. The PDF is created dynamically on the server, so I have to do this in the browser rather than the standalone application.
The workflow is this:
- An e-mail message is sent to the user, containing a link to a URL inside the application.
- The user clicks the link. The browser opens and requests the specified URL.
- The application delivers a PDF file (content type application/pdf).
- The user completes a form inside the PDF.
- The user clicks the "submit" button in the form.
- The PDF viewer and browser somehow cooperate to POST the form data back to the server, to a slightly different URL than that of the form itself (the form URL ends with a slash, and the submit action's URL is "submit/", therefore, it is appended).
- The application processes the data and returns a 303 redirect to a status page. (The problem occurs just the same if I send a 302 instead.)
- The browser GETs the status page (and any referenced resources).
What actually happens in step 8 is this: The browser requests the status page, but when it gets to the CSS stylesheet referenced in the page, it sends this:
GET /static/app.css HTTP/1.1
Accept: text/css, */*
Acrobat-Version: 11.0.6
Accept-Language: en-GB
Content-Type: application/vnd.adobe.xfdf; charset=utf-8
Content-Length: 1824
Referer: http://application/report/2014-03-28/925/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Host: application
DNT: 1
Connection: Keep-Alive
Cookie: sessionid=12345
Note that this request contains both a Content-Type and Content-Length header, which is unusual enough for a GET request, but there is no request body, not one byte, not 1824 of them. My server is IIS, which responds to this request with a 400 Invalid Verb (not sure why that particular error, but the 400 as such is certainly justified).
The request for the status page itself does not contain these headers; it is perfectly correct. For some reason, the stylesheet request repeats the headers from the form submission two requests earlier.
There is unfortunately not a lot of documentation for sending PDF form data via HTTP, but as far as I know, I'm doing everything right. I assume this is a bug in the Adobe Reader plugin and/or IE; can anyone think of a way to work around it?