Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Getting Image On PDF Document From VarBinary Data stored in SQL Server
posted

I strored binary data in MSSQL server table for image file and i want it to render on pdf report i am doing so by following code but eventually i am getting a distorted image over pdf.Can you please explain what could be the reason and how to overcome over it. 

 

 

Private Sub CreateHeader() 

Dim mainTable As Infragistics.Documents.Report.Table.ITable 

Dim mainRow As Infragistics.Documents.Report.Table.ITableRow

Dim imageCell As Infragistics.Documents.Report.Table.ITableCell 

Dim bandHeaderSP As Infragistics.Documents.Report.Band.IBandHeader = bandSP.Header 

mainTable = bandHeaderSP.AddTable

mainRow = mainTable.AddRow()

imageCell = mainRow.AddCell

 

‘Getting the datarow from data logic which is not written

Dim r As DataRow

imageCell .AddImage(GetBinaryImage(30, 10, TryCast(r.Item("Test_Icon"), Byte())))

End Sub

 Public Shared Function GetBinaryImage(ByVal width As Integer, ByVal height As Integer, ByVal imageData() As Byte) As Infragistics.Documents.Graphics.Image 

GetBinaryImage = Nothing

 Try

 

Dim imageToAdd As Infragistics.Documents.Graphics.Image = New Infragistics.Documents.Graphics.Image(width, height, imageData)

 

GetBinaryImage = imageToAdd 

Catch ex As Exception

Throw ex

 

End Try

End Function

DistortedImage