Esempio n. 1
0
 /**
  *
  */
 public CssAppliers()
 {
     chunk              = new ChunkCssApplier();
     paragraph          = new ParagraphCssApplier();
     nonewlineparagraph = new NoNewLineParagraphCssApplier();
     htmlcell           = new HtmlCellCssApplier();
     list          = new ListStyleTypeCssApplier();
     lineseparator = new LineSeparatorCssApplier();
     image         = new ImageCssApplier();
 }
Esempio n. 2
0
        /**
         *
         */

        public CssAppliersImpl()
        {
            map = new Dictionary <Type, ICssApplier>();
            map[typeof(Chunk)]              = new ChunkCssApplier(null);
            map[typeof(Paragraph)]          = new ParagraphCssApplier(this);
            map[typeof(NoNewLineParagraph)] = new NoNewLineParagraphCssApplier();
            map[typeof(HtmlCell)]           = new HtmlCellCssApplier();
            map[typeof(List)]          = new ListStyleTypeCssApplier();
            map[typeof(LineSeparator)] = new LineSeparatorCssApplier();
            map[typeof(text.Image)]    = new ImageCssApplier();
            map[typeof(PdfDiv)]        = new DivCssApplier();
        }
Esempio n. 3
0
        public void SetUp()
        {
            cells     = new List <Element>();
            tag       = new Tag("td", new Dictionary <String, String>());
            basicPara = new NoNewLineParagraph();
            basic     = new Chunk("content");

            cell    = new HtmlCell();
            applier = new HtmlCellCssApplier();


            LoggerFactory.GetInstance().SetLogger(new SysoLogger(3));
            Tag parent = new Tag("tr");

            parent.Parent = new Tag("table");
            tag.Parent    = parent;
            basicPara.Add(basic);
            cell.AddElement(basicPara);
            cells.Add(cell);
            config = new HtmlPipelineContext(null);
        }
Esempio n. 4
0
        /*
         * (non-Javadoc)
         *
         * @see
         * com.itextpdf.tool.xml.TagProcessor#endElement(com.itextpdf.tool.xml.Tag,
         * java.util.List, com.itextpdf.text.Document)
         */
        public override IList <IElement> End(IWorkerContext ctx, Tag tag, IList <IElement> currentContent)
        {
            HtmlCell cell = new HtmlCell();

            try {
                HtmlPipelineContext htmlPipelineContext = GetHtmlPipelineContext(ctx);
                cell = new HtmlCellCssApplier().Apply(cell, tag, htmlPipelineContext, htmlPipelineContext);
            } catch (NoCustomContextException e1) {
                throw new RuntimeWorkerException(LocaleMessages.GetInstance().GetMessage(LocaleMessages.NO_CUSTOM_CONTEXT), e1);
            }
            IList <IElement> l      = new List <IElement>(1);
            IList <IElement> chunks = new List <IElement>();

            foreach (IElement e in currentContent)
            {
                if (e is Chunk || e is NoNewLineParagraph || e is LineSeparator)
                {
                    if (e == Chunk.NEWLINE)
                    {
                        int index = currentContent.IndexOf(e);
                        if (index == currentContent.Count - 1)
                        {
                            continue;
                        }
                        else
                        {
                            IElement nextElement = currentContent[index + 1];
                            if (nextElement is Paragraph)
                            {
                                continue;
                            }
                            if (chunks.Count == 0)
                            {
                                continue;
                            }
                        }
                    }
                    else if (e is LineSeparator)
                    {
                        chunks.Add(Chunk.NEWLINE);
                    }
                    chunks.Add(e);
                    continue;
                }
                else if (chunks.Count > 0)
                {
                    Paragraph p = new Paragraph();
                    p.MultipliedLeading = 1.2f;
                    p.AddAll(chunks);
                    p.Alignment = cell.HorizontalAlignment;
                    cell.AddElement(p);
                    chunks.Clear();
                }

                if (e is Paragraph)
                {
                    ((Paragraph)e).Alignment = cell.HorizontalAlignment;
                }

                cell.AddElement(e);
            }
            if (chunks.Count > 0)
            {
                Paragraph p = new Paragraph();
                p.MultipliedLeading = 1.2f;
                p.AddAll(chunks);
                p.Alignment = cell.HorizontalAlignment;
                cell.AddElement(p);
            }
            l.Add(cell);
            return(l);
        }