Stephan Wiesner wrote:
>
> I have a PDF on the server. I read it into a Base64 encoded String and send
> it with SOAP to the client.
> The client determines the MimeType and writes it to a file.
> no problem.
> I, however, I want to give the file to a client, via a servlet, it get
> changed and will not display.
> The problem is, that I have a encoded String and a PrintWriter from the
> Servlet. Seems, this PrintWriter changes the byte[] in some way while
> sending it.
> The resulting PDF has the original size and displays fine, except that it is
> empty.
>
You can't output binary data with a PrintWriter - it tries to do
UNICODE translations. You have to use a ServletOutputStream from
the response getOutputStream method.
Be sure to set the Content-type and Content-length
--
WBB - [EMAIL PROTECTED]
Java Cert mock exams http://www.lanw.com/java/javacert/
Author of Java Developer's Guide to Servlets and JSP
ISBN 0-7821-2809-2