0
votes

I have a byte array and now I want to convert the byte array to a pdf file. I am using the following code, but when I try to see/open the pdf file, it shows

"Adobe reader could not open 'sample.pdf' becauase it is either not a supported file type or because the fiel has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)"

Thanks, Arefin

1
^ It would be better if you copy the above code, insert it into your question (formatted), and then delete the above comment. Always improve questions rather than adding several addendums in comments. - halfer

1 Answers

0
votes

Before you write the byte array to the response.outputstream, clear it and set the content type to "application/pdf". Flush after use.