I want to convert pdf file from image (Base64ToImage) in c# desktop application.
Here is my Base64ToImage code,
public Image Base64ToImage(string base64String)
{
if (base64String != "")
{
// Convert Base64 String to byte[]
byte[] imageBytes = Convert.FromBase64String(base64String);
MemoryStream ms = new MemoryStream(imageBytes, 0,
imageBytes.Length);
// Convert byte[] to Image
ms.Write(imageBytes, 0, imageBytes.Length);
Image image = Image.FromStream(ms, true);
return image;
}
else
{
return null;
}
}
Now, from this code in picturebox getting the image
Here is the sample code of fetch the image and upload in picturebox
pictureBox1.Image = Base64ToImage(dtSelStock.Rows[0]["DesignImage"].ToString());
Now, from here my question was there i.e. how can I convert pdf file from image which contains picturebox1.image?