Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello All,

I have byte array and am trying to create a pdf from it using below code. Its not showing any error/exception but pdf also not getting downloaded.

Am getting this byte array from "db" while am using "image" datatype in sql

Can someone tell me where i am doing mistake or any other alternate solution for creating pdf from byte array.

C#
private void downloadpdf(byte[] pdf)
        {

            Byte[] bytes = pdf;
            Response.Clear();

            MemoryStream ms = new MemoryStream(bytes);
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=test.pdf");
            Response.Buffer = true;
            ms.WriteTo(Response.OutputStream);

            Response.End();





Thanks in Advance
Posted

1 solution

There is an entire article in codeproject about what you searching now, sow find it or post enough code such that developers will help you.

Hope that helps
 
Share this answer
 
Comments
Leo Chapiro 10-Sep-15 8:34am    
I find your answer should be better a comment, this is not a solution at all.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900