i received image data string in response transform byte[] , write pdf file not able open in pdf says either corrupt file or not decoded correctly. when open text, see same string data received in response. please see below , correct me.
string response = "aaaaaaaaa......aaaaa=="; /*byte[] imagebytearray = response.getbytes(); */ /* decode string */ byte[] imagebytearray = base64.decodebase64(response); fileoutputstream imageoutfile = new fileoutputstream("d:/output.pdf"); imageoutfile.write(imagebytearray, 0, imagebytearray.length); imageinfile.close();
please find: enter link description here
writing pdf cannot done directly using java.io classes. need use apis itext write data pdf.
please check below url: http://itextpdf.com/
Comments
Post a Comment