et3rnal
et3rnal

Reputation: 342

Cefsharp LoadHtml throwing 'string too long'

I have been using loadhtml for some time now and its working fine for the simple thing I was using it for.

However, I recently started including images in my HTML in form of base64 and loadhtml doesn't like that and throughs string too long exception.

From what I understand so far that it's limited to ~2000 which is why it worked fine when the image was very small.

Is there a way to get around that?

Upvotes: 0

Views: 876

Answers (2)

Yonatan Tuchinsky
Yonatan Tuchinsky

Reputation: 419

As for CefSharp Version 75 there are 4 overloads for LoadHtml see: http://cefsharp.github.io/api/75.1.x/html/Overload_CefSharp_WebBrowserExtensions_LoadHtml.htm

Specifically call LoadHtml(this IWebBrowser browser, string html, bool base64Encode = false) and base64Encode:true.

It works even with large HTML

Upvotes: 2

PRABODH KANT Singh
PRABODH KANT Singh

Reputation: 26

You can embed HTML source in the project and read the project from the dlls into a string buffer. After that; use loadString method to load the required page.

Upvotes: 1

Related Questions