Increasing height of WebBrowser using asp.net c# code then getting error: Parameter is not valid
Increasing height of WebBrowser using asp.net c# code then getting error: Parameter is not valid
使用 asp.net c# 代码增加 WebBrowser
的高度然后出现错误:
Parameter is not valid.
下面是我截取页面的代码
private void webbrowse_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser webrowse = sender as WebBrowser;
Bitmap bitmap = new Bitmap(webrowse.Width, webrowse.Height);
webrowse.DrawToBitmap(bitmap, webrowse.Bounds); //geting error in this line
MemoryStream stream = new MemoryStream();
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] strbytes = stream.ToArray();
imgscreenshot.Visible = true;
imgscreenshot.ImageUrl = "data:image/jpeg;base64," + Convert.ToBase64String(strbytes);
}
如果我要在上面的 GenerateThumbnail
方法中增加 webrowser.Height = 20000;
的高度,然后出现错误:Parameter is not valid.
我的 aspx 页面中有 20 页高度,这就是为什么要增加高度.我无法增加长尺寸的高度。
在与@Mohd Mazhar Khan 一起寻找一段时间后,有一个解决方案:
The iss express was in 32-bit and it should be configured in 64-bit for manage
big amounts of memory.
更改设置是这样的:
Tools>Options>Projects and Solutions>Web Project and check the 64-bit
IISEXPRESS box.
使用 asp.net c# 代码增加 WebBrowser
的高度然后出现错误:
Parameter is not valid.
下面是我截取页面的代码
private void webbrowse_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser webrowse = sender as WebBrowser;
Bitmap bitmap = new Bitmap(webrowse.Width, webrowse.Height);
webrowse.DrawToBitmap(bitmap, webrowse.Bounds); //geting error in this line
MemoryStream stream = new MemoryStream();
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] strbytes = stream.ToArray();
imgscreenshot.Visible = true;
imgscreenshot.ImageUrl = "data:image/jpeg;base64," + Convert.ToBase64String(strbytes);
}
如果我要在上面的 GenerateThumbnail
方法中增加 webrowser.Height = 20000;
的高度,然后出现错误:Parameter is not valid.
我的 aspx 页面中有 20 页高度,这就是为什么要增加高度.我无法增加长尺寸的高度。
在与@Mohd Mazhar Khan 一起寻找一段时间后,有一个解决方案:
The iss express was in 32-bit and it should be configured in 64-bit for manage big amounts of memory.
更改设置是这样的:
Tools>Options>Projects and Solutions>Web Project and check the 64-bit IISEXPRESS box.