Quantcast
Channel: HTML Renderer
Viewing all articles
Browse latest Browse all 693

New Post: How to load PNG as `byte[]` to HtmlImageLoadEventArgs callback?

$
0
0
I have a PNG from a database as byte[]. How can I set as a HTML image? I use this for PDF creation and the wiki/documentation is sadly lacking...
        public void HandleImageLoad(object sender, HtmlImageLoadEventArgs args)
        {
              var img = LoadFromSource();
                if(img == null)
                {
                    args.Handled = false;
                    args.Callback();
                    Log.Error("Missing image: {0}", args.Src);
                }
                else
                {
                    args.Handled = true;
                    args.Callback(img.Data);
                }                                       
        }

Viewing all articles
Browse latest Browse all 693

Trending Articles