locked
WebView.CapturePreviewToStreamAsync() API throwing “Not enough storage is available to process this command. (Exception from HRESULT: 0x80070008)” exception when we capture big image.

    Question

  • Hi,

    I am using WebView.CapturePreviewToStreamAsync() API to capture the screenshot of the WebView  image. Here, I am capturing the screenshot of big html file (Converted big word file[more than 250pages] to html file and opened in WebView control). As we are getting catastrophic error while capturing the entire WebView control image, while capturing the screenshot I am setting the WebView control height as 50000 and capturing the screenshot. Once first screenshot is over, I am scrolling the WebView control to next 50000 and capturing the next screenshot. After taking each screenshot I am properly releasing the memory.

    But while capturing the third screenshot, the above API throwing “Not enough storage is available to process this command. (Exception from HRESULT: 0x80070008)” exception. Here the saved first and second screenshot image (.jpeg) size is 235MB. I am using below code.

    InMemoryRandomAccessStream msWebViewCtrlData = new InMemoryRandomAccessStream();                   

    try

    {                      

    await WebViewCtrl.CapturePreviewToStreamAsync(msWebViewCtrlData);

    }

    catch (Exception ex)

    {

    }

    msWebViewCtrlData.Dispose();

    msWebViewCtrlData = null;

    Could you please help my query regarding the WebView control?

    Thanks in advance.

    Hari

    Thursday, March 27, 2014 10:13 AM

Answers

  • Maybe you could try the "using" clause?

    using (InMemoryRandomAccessStream msWebViewCtrlData = new InMemoryRandomAccessStream)

    {
    ...code

    }


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, March 27, 2014 1:17 PM
    Moderator