I run the C# in zenno:
HtmlElement he = instance.ActiveTab.FindElementByAttribute("body","fulltag","body","text",0);
int heHeight = Convert.ToInt32(he.GetAttribute("height"));
int heWidth = Convert.ToInt32(he.GetAttribute("width"));
int step =1000;
int countOfIterations = heHeight/step;
var bitmaps = new List<System.Drawing.Bitmap>();
int count =0;
for(int i =0;i<countOfIterations;i++)
{
var text = he.DrawPartToBitmap(0, i*step, heWidth, step, true);
byte[] imageBytes = Convert.FromBase64String(text);
var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
img.Save(@"C:\images\part"+i.ToString()+@".jpg");
count++;
}
int lastPieceHeight = heHeight%step;
if (lastPieceHeight>10)
{
var text = he.DrawPartToBitmap(0, heHeight-lastPieceHeight, heWidth, lastPieceHeight, true);
byte[] imageBytes = Convert.FromBase64String(text);
var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
img.Save(@"C:\images\part"+count.ToString()+@".jpg");
}
but show error:
A generic error occurred in GDI+.
What happened? thank you
HtmlElement he = instance.ActiveTab.FindElementByAttribute("body","fulltag","body","text",0);
int heHeight = Convert.ToInt32(he.GetAttribute("height"));
int heWidth = Convert.ToInt32(he.GetAttribute("width"));
int step =1000;
int countOfIterations = heHeight/step;
var bitmaps = new List<System.Drawing.Bitmap>();
int count =0;
for(int i =0;i<countOfIterations;i++)
{
var text = he.DrawPartToBitmap(0, i*step, heWidth, step, true);
byte[] imageBytes = Convert.FromBase64String(text);
var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
img.Save(@"C:\images\part"+i.ToString()+@".jpg");
count++;
}
int lastPieceHeight = heHeight%step;
if (lastPieceHeight>10)
{
var text = he.DrawPartToBitmap(0, heHeight-lastPieceHeight, heWidth, lastPieceHeight, true);
byte[] imageBytes = Convert.FromBase64String(text);
var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
img.Save(@"C:\images\part"+count.ToString()+@".jpg");
}
but show error:
A generic error occurred in GDI+.
What happened? thank you