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.
Here the code:
Base64 bas = new Base64();
byte[] b = bas.decode(text);
// this works
FileOutputStream fo = new FileOutputStream("test.pdf");
fo.write(b);
fo.close();
// this doesn't
String aus = new String(b);
out.print( aus ); // PrintWriter out
// prinltn() doesn't work either.