Esempio n. 1
0
        /*
         * (non-Javadoc)
         *
         * @see
         * com.itextpdf.tool.xml.ITagProcessor#content(com.itextpdf.tool.xml.Tag,
         * java.util.List, com.itextpdf.text.Document, java.lang.String)
         */
        public override IList <IElement> Content(IWorkerContext ctx, Tag tag, String content)
        {
            String           sanitized = HTMLUtils.SanitizeInline(content);
            IList <IElement> l         = new List <IElement>(1);

            if (sanitized.Length > 0)
            {
                Chunk c = new ChunkCssApplier().Apply(new Chunk(sanitized), tag);
                //          NoNewLineParagraph noNewLineParagraph = new NoNewLineParagraphCssApplier(configuration).Apply(new NoNewLineParagraph(c), tag);
                l.Add(c);
            }
            return(l);
        }
Esempio n. 2
0
        public override IList <IElement> Content(IWorkerContext ctx, Tag tag, String content)
        {
            IList <IElement> l = new List <IElement>(1);

            String sanitized = HTMLUtils.SanitizeInline(content);         //TODO check this

            if (sanitized.Length > 0)
            {
                Chunk c = new ChunkCssApplier().Apply(new Chunk(sanitized), tag);
                l.Add(new Text(c, tag.CSS, null, null));
            }
            return(l);
        }
Esempio n. 3
0
        public override IList <IElement> Content(IWorkerContext ctx, Tag tag,
                                                 String content)
        {
            String           sanitized = HTMLUtils.SanitizeInline(content);
            IList <IElement> l         = new List <IElement>(1);

            if (sanitized.Length > 0)
            {
                Chunk c = GetCssAppliers().ChunkCssAplier.Apply(new Chunk(sanitized), tag);
                l.Add(c);
            }
            return(l);
        }
Esempio n. 4
0
        public override IList <IElement> Content(IWorkerContext ctx, Tag tag, String content)
        {
            float x = -1, y = -1;

            IDictionary <String, String> attributes = tag.Attributes;

            if (attributes != null)
            {
                try{
                    if (attributes.ContainsKey(X))
                    {
                        x = int.Parse(attributes[X]);
                    }
                }catch {
                    // TODO: handle exception
                }

                try{
                    if (attributes.ContainsKey(Y))
                    {
                        y = int.Parse(attributes[Y]);
                    }
                }catch {
                    // TODO: handle exception
                }
            }

            IList <IElement> l         = new List <IElement>(1);
            String           sanitized = HTMLUtils.SanitizeInline(content); //TODO check this

            if (sanitized.Length > 0 && attributes.ContainsKey(DX) && attributes.ContainsKey(DY))
            {
                Chunk c = new ChunkCssApplier().Apply(new Chunk(sanitized), tag);
                if (x == -1 && y == -1)
                {
                    l.Add(new Text(c, tag.CSS, Split(attributes[DX]), Split(attributes[DY])));
                }
                else
                {
                    l.Add(new Text(c, x, y, tag.CSS, Split(attributes[DX]), Split(attributes[DY])));
                }
            }
            return(l);
        }
Esempio n. 5
0
 virtual public void TestRTNinline()
 {
     Assert.AreEqual(" ", HTMLUtils.SanitizeInline("\r\n\t", false)[0].ToString());
 }