Hi,
I am using C#. I am trying to create a pdf file from byte array.
I tried the below code in the page load. The variable blob contains the byte array data.
Response.Clear();
Response.AddHeader("Content-Length", blob.Length.ToString());
Response.ContentType = "application/pdf";
Response.AddHeader("Accept-Ranges", "bytes");
Response.Buffer = true;
Response.AddHeader("Expires", "0");
Response.AddHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
Response.AddHeader("Pragma", "public");
Response.AddHeader("content-Transfer-Encoding", "binary");
Response.AddHeader("Content-Disposition", "attachment; filename=sample.pdf");
Response.BinaryWrite(blob);
Response.Flush();
Response.End();
The pdf is getting saved. But when I try to open the pdf, I am getting the error as " Acrobat could not open 'sample.pdf' because it is either not a supported file type or because the file has been damaged"
How to create a pdf file from a byte array?
Thank you
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.