You should never use JSPs to stream binary content; that's what
servlets are for. JSPs are for creating character output, using them for anything else is a bug waiting to happen. For example, I'm fairly certain that the PDF you downloaded does not have the same number of bytes as the original one.