Reputation: 33
i have a byte[] stream of data. i need to save this byte in to pdf format in disk. can any one help
Thanks in advance
Upvotes: 3
Views: 34020
Reputation: 269318
You could use File.WriteAllBytes
:
byte[] yourByteArray = GetYourByteArrayFromSomewhere();
File.WriteAllBytes(@"c:\example.pdf", yourByteArray);
Upvotes: 8
Reputation: 32258
One option is to create a FileStream
object and write the bytes to it with your PDF name and extension. e.g.
byte[] bytes = SomeMethodToGetBytesThatYouDefine();
FileStream fs = new FileStream(@"c:\somepath.pdf",FileMode.OpenOrCreate);
fs.Write(bytes,0,bytes.Length);
fs.Close();
Upvotes: 9