I am trying to generate pdf file using Byte Array. The code is used is:
Public Sub SavePdf(ByVal bytes() As Byte)
Dim filePath As String = HttpContext.Current.Server.MapPath("~/ClientBin/file1.pdf")
Dim byteData() As Byte = bytes
File.WriteAllBytes(filePath,byteData)
End Sub
The byte array is generated using richEditControl. The code is as follows:
Public Sub generateByte_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim ms As MemoryStream = New MemoryStream()
ms.Flush()
richEditControl1.SaveDocument(ms, DocumentFormat.Rtf)
client.SavePdf(ms.ToArray())
MessageBox.Show("FileSaved")
End Sub
The file so generated can't be open.