Esempio n. 1
0
        protected virtual void ParseCssStyles(StyleCollection collection, string content, PDFContextBase context)
        {
            bool parseCss = true;

            if (!string.IsNullOrEmpty(this.Relationship))
            {
                if (this.Relationship.Equals("stylesheet", StringComparison.OrdinalIgnoreCase) == false)
                {
                    parseCss = false;
                }
            }



            if (parseCss)
            {
                var parser = new Scryber.Styles.Parsing.CSSStyleParser(content, context);
                foreach (var style in parser)
                {
                    if (null != style)
                    {
                        collection.Add(style);
                    }
                }
            }
        }
Esempio n. 2
0
        protected virtual void AddCssStyles(StyleCollection collection, PDFContextBase context)
        {
            if (!string.IsNullOrEmpty(this.StyleType))
            {
                if (this.StyleType.Equals("text/css", StringComparison.OrdinalIgnoreCase) == false)
                {
                    return;
                }
            }

            if (!string.IsNullOrEmpty(this.Media))
            {
                if (this.Media == "all" || this.Media.StartsWith("all "))
                {
                    ;
                }
                else if (this.Media == "print" || this.Media.StartsWith("print "))
                {
                    ;
                }
                else
                {
                    return;
                }
            }

            var parser = new Scryber.Styles.Parsing.CSSStyleParser(this.Contents, context);

            foreach (var style in parser)
            {
                if (null != style)
                {
                    collection.Add(style);
                }
            }
        }