示例#1
0
 /**
  * @param e
  * @param t
  * @param ctx
  * @return the element with CSS applied onto
  */
 public IElement Apply(IElement e, Tag t, IMarginMemory mm, IPageSizeContainable psc, IImageProvider ip)
 {
     // warning, mapping is done by instance of, make sure to add things in the right order when adding more.
     if (e is Chunk)   // covers TabbedChunk & Chunk
     {
         e = chunk.Apply((Chunk)e, t);
     }
     else if (e is Paragraph)
     {
         e = paragraph.Apply((Paragraph)e, t, mm);
     }
     else if (e is NoNewLineParagraph)
     {
         e = nonewlineparagraph.Apply((NoNewLineParagraph)e, t, mm);
     }
     else if (e is HtmlCell)
     {
         e = htmlcell.Apply((HtmlCell)e, t, mm, psc);
     }
     else if (e is List)
     {
         e = list.Apply((List)e, t, ip);
     }
     else if (e is LineSeparator)
     {
         e = lineseparator.Apply((LineSeparator)e, t, psc);
     }
     else if (e is iTextSharp.text.Image)
     {
         e = image.Apply((iTextSharp.text.Image)e, t);
     }
     return(e);
 }
示例#2
0
        virtual public void SetUp()
        {
            parent = new Tag("body");
            parent.CSS[CSS.Property.FONT_FAMILY] = "Helvetica";
            parent.CSS[CSS.Property.FONT_SIZE]   = "12pt";
            first = new Tag(null);
            first.CSS[CSS.Property.FONT_FAMILY] = "Helvetica";
            first.CSS[CSS.Property.FONT_SIZE]   = "12pt";
            second = new Tag(null);
            second.CSS[CSS.Property.FONT_FAMILY] = "Helvetica";
            second.CSS[CSS.Property.FONT_SIZE]   = "12pt";
            child = new Tag(null);
            child.CSS[CSS.Property.FONT_FAMILY] = "Helvetica";
            child.CSS[CSS.Property.FONT_SIZE]   = "12pt";

            parent.AddChild(first);
            first.Parent  = parent;
            second.Parent = parent;
            first.AddChild(child);
            second.AddChild(child);
            parent.CSS[CSS.Property.FONT_SIZE] = fst.TranslateFontSize(parent) + "pt";
            first.CSS[CSS.Property.FONT_SIZE]  = fst.TranslateFontSize(first) + "pt";
            first.CSS[CSS.Property.TEXT_ALIGN] = CSS.Value.LEFT;
            second.CSS[CSS.Property.FONT_SIZE] = fst.TranslateFontSize(second) + "pt";
            child.CSS[CSS.Property.FONT_SIZE]  = fst.TranslateFontSize(child) + "pt";
            firstPara     = new Paragraph(new Chunk("default text for chunk creation"));
            secondPara    = new Paragraph(new Chunk("default text for chunk creation"));
            configuration = new HtmlPipelineContext(null);
            applier.Apply(firstPara, first, configuration);
        }