Ejemplo n.º 1
0
        virtual public void ParseCSS()
        {
            retriever.ProcessFromStream(File.OpenRead(RESOURCES + "/css/test.css"), proc);
            ICssFile file = proc.GetCss();
            IDictionary <String, String> map = file.Get("body");

            Assert.IsTrue(map.ContainsKey("margin"), "margin not found.");
            Assert.AreEqual("20px", map["margin"], "Value for margin not correct.");
        }
Ejemplo n.º 2
0
        virtual public void ParseCSS()
        {
            retriever.ProcessFromStream(File.OpenRead(RESOURCES + "/css/test.css"), proc);
            ICssFile        file  = proc.GetCss();
            IList <CssRule> rules = file.Get(new Tag("body"));

            Assert.IsTrue(rules.Count == 1);
            Assert.IsTrue(rules[0].NormalDeclarations.ContainsKey("margin"), "margin not found.");
            Assert.AreEqual("20px", rules[0].NormalDeclarations["margin"], "Value for margin not correct.");
        }
Ejemplo n.º 3
0
        /*
         * (non-Javadoc)
         * @see com.itextpdf.tool.xml.pipeline.css.CSSResolver#addCss(java.lang.String, java.lang.String)
         */
        public void AddCss(String content, Encoding charSet, bool isPersistent)
        {
            CssFileProcessor proc = new CssFileProcessor();

            try {
                retrieve.ProcessFromStream(new MemoryStream(charSet.GetBytes(content)), proc);
                ICssFile css = proc.GetCss();
                css.IsPersistent(isPersistent);
                this.cssFiles.Add(css);
            } catch (IOException e) {
                throw new CssResolverException(e);
            }
        }