Had this problem myself.
You are using JSPs to write binary content which is generally not advised (servlets preferred).
The JSPWriter will write out content when you have two <% %> <% %> scriptlet tags defined AND whatever template tags you have before, in between (carriage return, spaces, etc.), and after. So setting the content-length = size of the PDF is actually wrong since the content length would include these extra characters.
If you must do it via JSP make sure there are NO trailing spaces, at the end of your JSP and your scriplet blocks are back-to-back <% %><% %>. then your content-lenght number will be accurate.
hope this helps.