This is a migrated thread and some comments may be shown as answers.

Inserting Image

1 Answer 429 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 29 Sep 2014, 07:02 AM
Hi,

Your example shows how to insert jpg image from file:

Using stream As Stream = Me.GetResourceStream("Telerik_logo.jpg")
editor.DrawImage(stream, ImageFormat.Jpeg, New Size(118, 28))
End Using

I would like to insert image from .NET Image class variable. The images are stored in Base64 format in a database.

Could you provide a code snippet for that?

Regards,
Brian

1 Answer, 1 is accepted

Sort by
0
Kammen
Telerik team
answered on 29 Sep 2014, 08:43 AM
Hello Brian,

You can convert the Base64 string to memory stream (see the code below) and use it in the DrawImage method.

Dim imageBytes As Byte() = Convert.FromBase64String(base64String)
Dim ms As New MemoryStream(imageBytes, 0, imageBytes.Length)

Note that currently only JPEG images are supported.

Hope this helps.


Regards,
Kammen
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
PdfProcessing
Asked by
Brian
Top achievements
Rank 1
Answers by
Kammen
Telerik team
Share this question
or