MhtLoadOptions options= new MhtLoadOptions();
Resolution resolution = new Resolution(300);
BmpDevice imageDevice = new BmpDevice(resolution);
Document pdfDocument= new Document(_dataDir + "test.mhtm", options);
for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
using (FileStream imageStream =
new FileStream($"{_dataDir}image{pageCount}_out.{ext}", FileMode.Create))
{
// Convert a particular page and save the image to stream
imageDevice.Process(pdfDocument.Pages[pageCount], imageStream);
// Close stream
imageStream.Close();
}
}