private void HandleFont(string token, StyleInfo model)
        {
            StyleInfo si = model.Clone() as StyleInfo;  // always push a StyleInfo

            _StyleStack.Push(si);                       //   since they will always be popped

            PageTextHtmlCmdLexer hc = new PageTextHtmlCmdLexer(token.Substring(5));
            Hashtable            ht = hc.Lex();

            string style = (string)ht["style"];

            HandleStyleString(style, si);

            string color = (string)ht["color"];

            if (color != null && color.Length > 0)
            {
                si.Color = XmlUtil.ColorFromHtml(color, si.Color);
            }

            string size = (string)ht["size"];

            if (size != null && size.Length > 0)
            {
                HandleStyleFontSize(si, size);
            }

            string face = (string)ht["face"];

            if (face != null && face.Length > 0)
            {
                si.FontFamily = face;
            }

            return;
        }
        private void HandleFont(string token, StyleInfo model)
        {
            StyleInfo si = model.Clone() as StyleInfo;	// always push a StyleInfo
            _StyleStack.Push(si);						//   since they will always be popped

            PageTextHtmlCmdLexer hc = new PageTextHtmlCmdLexer(token.Substring(5));
            Hashtable ht = hc.Lex();

            string style = (string)ht["style"];
            HandleStyleString(style, si);

            string color = (string)ht["color"];
            if (color != null && color.Length > 0)
                si.Color = XmlUtil.ColorFromHtml(color, si.Color);

            string size = (string)ht["size"];
            if (size != null && size.Length > 0)
                HandleStyleFontSize(si, size);

            string face = (string)ht["face"];
            if (face != null && face.Length > 0)
                si.FontFamily = face;

            return;
        }
        private PageImage BuildImage(Graphics g, string token, StyleInfo oldsi, PageText model)
        {
            PageTextHtmlCmdLexer hc = new PageTextHtmlCmdLexer(token.Substring(4));
            Hashtable ht = hc.Lex();

            string src = (string)ht["src"];
            if (src == null || src.Length < 1)
                return null;

            string alt = (string)ht["alt"];

            string height = (string)ht["height"];
            string width = (string)ht["width"];
            string align = (string)ht["align"];

            Stream strm = null;
            System.Drawing.Image im = null;
            PageImage pi = null;
            try
            {
                // Obtain the image stream
                if (src.StartsWith("http:") ||
                    src.StartsWith("file:") ||
                    src.StartsWith("https:"))
                {
                    WebRequest wreq = WebRequest.Create(src);
                    WebResponse wres = wreq.GetResponse();
                    strm = wres.GetResponseStream();
                }
                else
                    strm = new FileStream(src, System.IO.FileMode.Open, FileAccess.Read);

                im = System.Drawing.Image.FromStream(strm);
                int h = im.Height;
                int w = im.Width;
                MemoryStream ostrm = new MemoryStream();
                ImageFormat imf;
                imf = ImageFormat.Jpeg;
                im.Save(ostrm, imf);
                byte[] ba = ostrm.ToArray();
                ostrm.Close();
                pi = new PageImage(imf, ba, w, h);
                pi.AllowSelect = false;
                pi.Page = this.Page;
                pi.HyperLink = model.HyperLink;
                pi.Tooltip = alt == null ? model.Tooltip : alt;
                pi.X = 0;
                pi.Y = 0;

                pi.W = RSize.PointsFromPixels(g, width != null? Convert.ToInt32(width): w);
                pi.H = RSize.PointsFromPixels(g, height != null? Convert.ToInt32(height): h);
                pi.SI = new StyleInfo();
            }
            catch 
            {
                pi = null;
            }
            finally
            {
                if (strm != null)
                    strm.Close();
                if (im != null)
                    im.Dispose();
            }

            return pi;
        }
        private PageImage BuildImage(Graphics g, string token, StyleInfo oldsi, PageText model)
        {
            PageTextHtmlCmdLexer hc = new PageTextHtmlCmdLexer(token.Substring(4));
            Hashtable            ht = hc.Lex();

            string src = (string)ht["src"];

            if (src == null || src.Length < 1)
            {
                return(null);
            }

            string alt = (string)ht["alt"];

            string height = (string)ht["height"];
            string width  = (string)ht["width"];
            string align  = (string)ht["align"];

            Stream strm = null;

            System.Drawing.Image im = null;
            PageImage            pi = null;

            try
            {
                // Obtain the image stream
                if (src.StartsWith("http:") ||
                    src.StartsWith("file:") ||
                    src.StartsWith("https:"))
                {
                    WebRequest  wreq = WebRequest.Create(src);
                    WebResponse wres = wreq.GetResponse();
                    strm = wres.GetResponseStream();
                }
                else
                {
                    strm = new FileStream(src, System.IO.FileMode.Open, FileAccess.Read);
                }

                im = System.Drawing.Image.FromStream(strm);
                int          h     = im.Height;
                int          w     = im.Width;
                MemoryStream ostrm = new MemoryStream();
                ImageFormat  imf;
                imf = ImageFormat.Jpeg;
                im.Save(ostrm, imf);
                byte[] ba = ostrm.ToArray();
                ostrm.Close();
                pi             = new PageImage(imf, ba, w, h);
                pi.AllowSelect = false;
                pi.Page        = this.Page;
                pi.HyperLink   = model.HyperLink;
                pi.Tooltip     = alt == null ? model.Tooltip : alt;
                pi.X           = 0;
                pi.Y           = 0;

                pi.W  = RSize.PointsFromPixels(g, width != null? Convert.ToInt32(width): w);
                pi.H  = RSize.PointsFromPixels(g, height != null? Convert.ToInt32(height): h);
                pi.SI = new StyleInfo();
            }
            catch
            {
                pi = null;
            }
            finally
            {
                if (strm != null)
                {
                    strm.Close();
                }
                if (im != null)
                {
                    im.Dispose();
                }
            }

            return(pi);
        }