void IHTMLTagProcessor.StartElement(HTMLWorker worker, string tag, IDictionary <string, string> attrs)
 {
     if (!attrs.ContainsKey(HtmlTags.WIDTH))
     {
         //Do something special here
         attrs.Add(HtmlTags.WIDTH, "400px");
     }
     if (!attrs.ContainsKey(HtmlTags.HEIGHT))
     {
         //Do something special here
         attrs.Add(HtmlTags.HEIGHT, "400px");
     }
     worker.UpdateChain(tag, attrs);
     worker.ProcessImage(worker.CreateImage(attrs), attrs);
     worker.UpdateChain(tag);
 }
Exemplo n.º 2
0
        public void StartElement(HTMLWorker worker, string tag, IDictionary <string, string> attrs)
        {
            Image image;
            var   src = attrs["src"];

            if (src.StartsWith("data:image/"))
            {
                // data:[<MIME-type>][;charset=<encoding>][;base64],<data>
                var base64Data = src.Substring(src.IndexOf(",") + 1);
                var imagedata  = Convert.FromBase64String(base64Data);
                image = Image.GetInstance(imagedata);
            }
            else
            {
                image = Image.GetInstance(src);
            }

            worker.UpdateChain(tag, attrs);
            worker.ProcessImage(image, attrs);
            worker.UpdateChain(tag);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Tells the HTMLWorker what to do when an open tag is encountered.
 /// </summary>
 public void StartElement(HTMLWorker worker, string tag, IDictionary <string, string> attrs)
 {
     worker.UpdateChain(tag, attrs);
     worker.ProcessImage(_image, attrs);
     worker.UpdateChain(tag);
 }