I would like to convert a PDF to a Bitmap, so I can show it on my ASP.NET page. But when I run my code it fails at creating the Bitmap.
Does anyone know what's the problem?
string filepath = "C:\\Temp\\Sample.pdf";
byte[] pdfByte = File.ReadAllBytes(filepath);
var strBase64 = Convert.ToBase64String(pdfByte);
using (MemoryStream ms = new MemoryStream(Convert.FromBase64String(strBase64)))
{
    using (Bitmap bm2 = new Bitmap(ms))
    {
        bm2.Save("c:\\" + "test");
    }
}
 
    