GetImageProvider() публичный Метод

public GetImageProvider ( ) : IImageProvider
Результат IImageProvider
        /**
         * The ListCssApplier has the capabilities to change the type of the given {@link List} dependable on the css.
         * This means: <strong>Always replace your list with the returned one and add content to the list after applying!</strong>
         */
        // not implemented: list-style-type:armenian, georgian, decimal-leading-zero.
        virtual public List Apply(List list, Tag t, HtmlPipelineContext context) {
            float fontSize = FontSizeTranslator.GetInstance().GetFontSize(t);
            List lst = list;
            IDictionary<String, String> css = t.CSS;
            String styleType;
            css.TryGetValue(CSS.Property.LIST_STYLE_TYPE, out styleType);
            BaseColor color = HtmlUtilities.DecodeColor(css.ContainsKey(CSS.Property.COLOR) ? css[CSS.Property.COLOR] : null);
            if (null == color) color = BaseColor.BLACK;

            if (null != styleType) {
                if (Util.EqualsIgnoreCase(styleType, CSS.Value.NONE)) {
                    lst.Lettered = false;
                    lst.Numbered = false;
                    lst.SetListSymbol("");
                } else if (Util.EqualsIgnoreCase(CSS.Value.DECIMAL, styleType)) {
                    lst = new List(List.ORDERED);
                } else if (Util.EqualsIgnoreCase(CSS.Value.DISC, styleType)) {
                    lst = new ZapfDingbatsList(108);
                    lst.Autoindent = false;
                    lst.SymbolIndent = 7.75f;
                    Chunk symbol = lst.Symbol;
                    symbol.SetTextRise(1.5f);
                    Font font = symbol.Font;
                    font.Size = 4.5f;
                    font.Color = color;
                } else if (Util.EqualsIgnoreCase(CSS.Value.SQUARE, styleType)) {
                    lst = new ZapfDingbatsList(110);
                    ShrinkSymbol(lst, fontSize, color);
                } else if (Util.EqualsIgnoreCase(CSS.Value.CIRCLE, styleType)) {
                    lst = new ZapfDingbatsList(109);
                    lst.Autoindent = false;
                    lst.SymbolIndent = 7.75f;
                    Chunk symbol = lst.Symbol;
                    symbol.SetTextRise(1.5f);
                    Font font = symbol.Font;
                    font.Size = 4.5f;
                    font.Color = color;
                } else if (CSS.Value.LOWER_ROMAN.Equals(styleType)) {
                    lst = new RomanList(true, 0);
                    lst.Autoindent = true;
                    SynchronizeSymbol(fontSize, lst, color);
                } else if (CSS.Value.UPPER_ROMAN.Equals(styleType)) {
                    lst = new RomanList(false, 0);
                    SynchronizeSymbol(fontSize, lst, color);
                    lst.Autoindent = true;
                } else if (CSS.Value.LOWER_GREEK.Equals(styleType)) {
                    lst = new GreekList(true, 0);
                    SynchronizeSymbol(fontSize, lst, color);
                    lst.Autoindent = true;
                } else if (CSS.Value.UPPER_GREEK.Equals(styleType)) {
                    lst = new GreekList(false, 0);
                    SynchronizeSymbol(fontSize, lst, color);
                    lst.Autoindent = true;
                } else if (CSS.Value.LOWER_ALPHA.Equals(styleType) || CSS.Value.LOWER_LATIN.Equals(styleType)) {
                    lst = new List(List.ORDERED, List.ALPHABETICAL);
                    SynchronizeSymbol(fontSize, lst, color);
                    lst.Lowercase = true;
                    lst.Autoindent = true;
                } else if (CSS.Value.UPPER_ALPHA.Equals(styleType) || CSS.Value.UPPER_LATIN.Equals(styleType)) {
                    lst = new List(List.ORDERED, List.ALPHABETICAL);
                    SynchronizeSymbol(fontSize, lst, color);
                    lst.Lowercase = false;
                    lst.Autoindent = true;
                }
            } else if (Util.EqualsIgnoreCase(t.Name, HTML.Tag.OL)) {
                lst = new List(List.ORDERED);
                 String type = null;
                 t.Attributes.TryGetValue("type", out type);
 		         if (type != null) {
                   if (type.Equals("A")) {
 	                     lst.Lettered = true;
 	                    } else if (type.Equals("a")) {
 		                 lst.Lettered = true;
 	                     lst.Lowercase = true;
 		                }
 	               }
                SynchronizeSymbol(fontSize, lst, color);
                lst.Autoindent = true;
            } else if (Util.EqualsIgnoreCase(t.Name, HTML.Tag.UL)) {
                lst = new List(List.UNORDERED);
                ShrinkSymbol(lst, fontSize, color);
            }
            if (css.ContainsKey(CSS.Property.LIST_STYLE_IMAGE)
                    && !Util.EqualsIgnoreCase(css[CSS.Property.LIST_STYLE_IMAGE], CSS.Value.NONE)) {
                lst = new List();
                String url = utils.ExtractUrl(css[CSS.Property.LIST_STYLE_IMAGE]);
                try {
                    Image img = new ImageRetrieve(context.ResourcePath, context.GetImageProvider()).RetrieveImage(url);
                    lst.ListSymbol = new Chunk(img, 0, 0, false);
                    lst.SymbolIndent = img.Width;
                    if (LOG.IsLogging(Level.TRACE)) {
                        LOG.Trace(String.Format(LocaleMessages.GetInstance().GetMessage("html.tag.list"), url));
                    }
                } catch (NoImageException e) {
                    if (LOG.IsLogging(Level.ERROR)) {
                        LOG.Error(String.Format(LocaleMessages.GetInstance().GetMessage("html.tag.img.failed"), url), e);
                    }
                    lst = new List(List.UNORDERED);
                }
                lst.Autoindent = false;
            }
            lst.Alignindent = false;
            float leftIndent = 0;
            if (css.ContainsKey(CSS.Property.LIST_STYLE_POSITION) && Util.EqualsIgnoreCase(css[CSS.Property.LIST_STYLE_POSITION], CSS.Value.INSIDE)) {
                leftIndent += 30;
            } else {
                leftIndent += 15;
            }
            leftIndent += css.ContainsKey(CSS.Property.MARGIN_LEFT)?utils.ParseValueToPt(css[CSS.Property.MARGIN_LEFT],fontSize):0;
            leftIndent += css.ContainsKey(CSS.Property.PADDING_LEFT)?utils.ParseValueToPt(css[CSS.Property.PADDING_LEFT],fontSize):0;
            lst.IndentationLeft = leftIndent;
            String startAtr = null;
            t.Attributes.TryGetValue(HTML.Attribute.START, out startAtr);
            if (startAtr != null) {
                try {
                    int start = int.Parse(startAtr);
                    lst.First = start;
                } catch (FormatException exc) {
                }
            }
            return lst;
        }
Пример #2
0
        virtual public PdfDiv Apply(PdfDiv div, Tag t, IMarginMemory memory, IPageSizeContainable psc, HtmlPipelineContext context)
        {
            if (t.Attributes.ContainsKey("id"))
                div.Tag = t.Attributes["id"];

            IDictionary<String, String> css = t.CSS;
            float fontSize = FontSizeTranslator.GetInstance().TranslateFontSize(t);
            if (fontSize == Font.UNDEFINED)
            {
                fontSize = FontSizeTranslator.DEFAULT_FONT_SIZE;
            }
            String align = null;
            if (t.Attributes.ContainsKey(HTML.Attribute.ALIGN))
            {
                align = t.Attributes[HTML.Attribute.ALIGN];
            }
            else if (css.ContainsKey(CSS.Property.TEXT_ALIGN))
            {
                align = css[CSS.Property.TEXT_ALIGN];
            }

            if (align != null)
            {
                div.TextAlignment = CSS.GetElementAlignment(align);
            }


            String widthValue;
            if (!css.TryGetValue(HTML.Attribute.WIDTH, out widthValue))
            {
                t.Attributes.TryGetValue(HTML.Attribute.WIDTH, out widthValue);
            }
            if (widthValue != null)
            {
                float pageWidth = psc.PageSize.Width;
                if (utils.IsNumericValue(widthValue) || utils.IsMetricValue(widthValue))
                {
                    div.Width = Math.Min(pageWidth, utils.ParsePxInCmMmPcToPt(widthValue));
                }
                else if (utils.IsRelativeValue(widthValue))
                {
                    if (widthValue.Contains(CSS.Value.PERCENTAGE))
                    {
                        div.PercentageWidth = utils.ParseRelativeValue(widthValue, 1f);
                    }
                    else
                    {
                        div.Width = Math.Min(pageWidth, utils.ParseRelativeValue(widthValue, fontSize));
                    }
                }
            }

            String heightValue;
            if (!css.TryGetValue(HTML.Attribute.HEIGHT, out heightValue))
            {
                t.Attributes.TryGetValue(HTML.Attribute.HEIGHT, out heightValue);
            }
            if (heightValue != null)
            {
                if (utils.IsNumericValue(heightValue) || utils.IsMetricValue(heightValue))
                {
                    div.Height = utils.ParsePxInCmMmPcToPt(heightValue);
                }
                else if (utils.IsRelativeValue(heightValue))
                {
                    if (heightValue.Contains(CSS.Value.PERCENTAGE))
                    {
                        div.PercentageHeight = utils.ParseRelativeValue(heightValue, 1f);
                    }
                    else
                    {
                        div.Height = utils.ParseRelativeValue(heightValue, fontSize);
                    }
                }
            }

            float? marginTop = null;
            float? marginBottom = null;

            foreach (KeyValuePair<String, String> entry in css)
            {
                String key = entry.Key;
                String value = entry.Value;
                if (Util.EqualsIgnoreCase(key, CSS.Property.LEFT))
                {
                    div.Left = utils.ParseValueToPt(value, fontSize);
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.RIGHT))
                {
                    if (div.Width == null || div.Left == null)
                    {
                        div.Right = utils.ParseValueToPt(value, fontSize);
                    }
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.TOP))
                {
                    div.Top = utils.ParseValueToPt(value, fontSize);
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.BOTTOM))
                {
                    if (div.Height == null || div.Top == null)
                    {
                        div.Bottom = utils.ParseValueToPt(value, fontSize);
                    }
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.BACKGROUND_COLOR))
                {
                    div.BackgroundColor = HtmlUtilities.DecodeColor(value);
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.BACKGROUND_IMAGE))
                {
                    string url = utils.ExtractUrl(value);
                    try
                    {
                        Image img =
                            new ImageRetrieve(context.ResourcePath, context.GetImageProvider()).RetrieveImage(url);
                        div.BackgroundImage = img;
                    }
                    catch (NoImageException e)
                    {
                        if (LOG.IsLogging(Level.ERROR))
                        {
                            LOG.Error(string.Format(LocaleMessages.GetInstance().GetMessage("html.tag.img.failed"), url), e);
                        }
                    }
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.PADDING_LEFT))
                {
                    div.PaddingLeft = utils.ParseValueToPt(value, fontSize);
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.PADDING_RIGHT))
                {
                    div.PaddingRight = utils.ParseValueToPt(value, fontSize);
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.PADDING_TOP))
                {
                    div.PaddingTop = utils.ParseValueToPt(value, fontSize);
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.PADDING_BOTTOM))
                {
                    div.PaddingBottom = utils.ParseValueToPt(value, fontSize);
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.MARGIN_TOP))
                {
                    div.SpacingBefore = div.SpacingBefore + utils.CalculateMarginTop(value, fontSize, memory);
                    marginTop = utils.CalculateMarginTop(value, fontSize, memory);
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.MARGIN_BOTTOM))
                {
                    div.SpacingAfter = div.SpacingAfter + utils.CalculateMarginTop(value, fontSize, memory);
                    marginBottom = utils.ParseValueToPt(value, fontSize);
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.FLOAT))
                {
                    if (Util.EqualsIgnoreCase(value, CSS.Value.LEFT))
                    {
                        div.Float = PdfDiv.FloatType.LEFT;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.RIGHT))
                    {
                        div.Float = PdfDiv.FloatType.RIGHT;
                    }
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.POSITION))
                {
                    if (Util.EqualsIgnoreCase(value, CSS.Value.ABSOLUTE))
                    {
                        div.Position = PdfDiv.PositionType.ABSOLUTE;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.FIXED))
                    {
                        div.Position = PdfDiv.PositionType.FIXED;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.RELATIVE))
                    {
                        div.Position = PdfDiv.PositionType.RELATIVE;
                    }
                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.DISPLAY))
                {
                    if (Util.EqualsIgnoreCase(value, CSS.Value.BLOCK))
                    {
                        div.Display = PdfDiv.DisplayType.BLOCK;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.INLINE))
                    {
                        div.Display = PdfDiv.DisplayType.INLINE;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.INLINE_BLOCK))
                    {
                        div.Display = PdfDiv.DisplayType.INLINE_BLOCK;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.INLINE_TABLE))
                    {
                        div.Display = PdfDiv.DisplayType.INLINE_TABLE;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.LIST_ITEM))
                    {
                        div.Display = PdfDiv.DisplayType.LIST_ITEM;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.NONE))
                    {
                        div.Display = PdfDiv.DisplayType.NONE;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.RUN_IN))
                    {
                        div.Display = PdfDiv.DisplayType.RUN_IN;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.TABLE))
                    {
                        div.Display = PdfDiv.DisplayType.TABLE;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.TABLE_CAPTION))
                    {
                        div.Display = PdfDiv.DisplayType.TABLE_CAPTION;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.TABLE_CELL))
                    {
                        div.Display = PdfDiv.DisplayType.TABLE_CELL;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.TABLE_COLUMN_GROUP))
                    {
                        div.Display = PdfDiv.DisplayType.TABLE_COLUMN_GROUP;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.TABLE_COLUMN))
                    {
                        div.Display = PdfDiv.DisplayType.TABLE_COLUMN;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.TABLE_FOOTER_GROUP))
                    {
                        div.Display = PdfDiv.DisplayType.TABLE_FOOTER_GROUP;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.TABLE_HEADER_GROUP))
                    {
                        div.Display = PdfDiv.DisplayType.TABLE_HEADER_GROUP;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.TABLE_ROW))
                    {
                        div.Display = PdfDiv.DisplayType.TABLE_ROW;
                    }
                    else if (Util.EqualsIgnoreCase(value, CSS.Value.TABLE_ROW_GROUP))
                    {
                        div.Display = PdfDiv.DisplayType.TABLE_ROW_GROUP;
                    }
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BORDER_TOP_STYLE, key) || Util.EqualsIgnoreCase(CSS.Property.BORDER_TOP, key))
                {
                    if (value.Contains(CSS.Value.DOTTED))
                    {
                        div.BorderStyleTop = PdfDiv.BorderStyle.DOTTED;
                    }
                    else if (value.Contains(CSS.Value.DASHED))
                    {
                        div.BorderStyleTop = PdfDiv.BorderStyle.DASHED;
                    }
                    else if (value.Contains(CSS.Value.SOLID))
                    {
                        div.BorderStyleTop = PdfDiv.BorderStyle.SOLID;
                    }
                    else if (value.Contains(CSS.Value.DOUBLE))
                    {
                        div.BorderStyleTop = PdfDiv.BorderStyle.DOUBLE;
                    }
                    else if (value.Contains(CSS.Value.GROOVE))
                    {
                        div.BorderStyleTop = PdfDiv.BorderStyle.GROOVE;
                    }
                    else if (value.Contains(CSS.Value.RIDGE))
                    {
                        div.BorderStyleTop = PdfDiv.BorderStyle.RIDGE;
                    }
                    else if (value.Contains(CSS.Value.INSET))
                    {
                        div.BorderStyleTop = PdfDiv.BorderStyle.INSET;
                    }
                    else if (value.Contains(CSS.Value.OUTSET))
                    {
                        div.BorderStyleTop = PdfDiv.BorderStyle.OUTSET;
                    }

                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BORDER_BOTTOM_STYLE, key) || Util.EqualsIgnoreCase(CSS.Property.BORDER_BOTTOM, key))
                {
                    if (value.Contains(CSS.Value.DOTTED))
                    {
                        div.BorderStyleBottom = PdfDiv.BorderStyle.DOTTED;
                    }
                    else if (value.Contains(CSS.Value.DASHED))
                    {
                        div.BorderStyleBottom = PdfDiv.BorderStyle.DASHED;
                    }
                    else if (value.Contains(CSS.Value.SOLID))
                    {
                        div.BorderStyleBottom = PdfDiv.BorderStyle.SOLID;
                    }
                    else if (value.Contains(CSS.Value.DOUBLE))
                    {
                        div.BorderStyleBottom = PdfDiv.BorderStyle.DOUBLE;
                    }
                    else if (value.Contains(CSS.Value.GROOVE))
                    {
                        div.BorderStyleBottom = PdfDiv.BorderStyle.GROOVE;
                    }
                    else if (value.Contains(CSS.Value.RIDGE))
                    {
                        div.BorderStyleBottom = PdfDiv.BorderStyle.RIDGE;
                    }
                    else if (value.Contains(CSS.Value.INSET))
                    {
                        div.BorderStyleBottom = PdfDiv.BorderStyle.INSET;
                    }
                    else if (value.Contains(CSS.Value.OUTSET))
                    {
                        div.BorderStyleBottom = PdfDiv.BorderStyle.OUTSET;
                    }

                }
                else if (Util.EqualsIgnoreCase(key, CSS.Property.PAGE_BREAK_INSIDE))
                {
                    if (Util.EqualsIgnoreCase(value, CSS.Value.AVOID))
                    {
                        div.KeepTogether = true;
                    }
                }

                //TODO: border, background properties.
            }

            return div;
        }
Пример #3
0
 /**
  * The ListCssApplier has the capabilities to change the type of the given {@link List} dependable on the css.
  * This means: <strong>Always replace your list with the returned one and add content to the list after applying!</strong>
  */
 // not implemented: list-style-type:armenian, georgian, decimal-leading-zero.
 public List Apply(List list, Tag t, HtmlPipelineContext htmlPipelineContext)
 {
     float fontSize = FontSizeTranslator.GetInstance().GetFontSize(t);
     List lst = list;
     IDictionary<String, String> css = t.CSS;
     String styleType;
     css.TryGetValue(CSS.Property.LIST_STYLE_TYPE, out styleType);
     if (null != styleType) {
         if (Util.EqualsIgnoreCase(styleType, CSS.Value.NONE)) {
             lst.Lettered = false;
             lst.Numbered = false;
             lst.SetListSymbol("");
         } else if (Util.EqualsIgnoreCase(CSS.Value.DECIMAL, styleType)) {
             lst = new List(List.ORDERED);
             SynchronizeSymbol(fontSize, lst);
         } else if (Util.EqualsIgnoreCase(CSS.Value.DISC, styleType)) {
             lst = new ZapfDingbatsList(108);
             ShrinkSymbol(lst, fontSize);
         } else if (Util.EqualsIgnoreCase(CSS.Value.SQUARE, styleType)) {
             lst = new ZapfDingbatsList(110);
             ShrinkSymbol(lst, fontSize);
         } else if (Util.EqualsIgnoreCase(CSS.Value.CIRCLE, styleType)) {
             lst = new ZapfDingbatsList(109);
             ShrinkSymbol(lst, fontSize);
         } else if (CSS.Value.LOWER_ROMAN.Equals(styleType)) {
             lst = new RomanList(true, 0);
             SynchronizeSymbol(fontSize, lst);
         } else if (CSS.Value.UPPER_ROMAN.Equals(styleType)) {
             lst = new RomanList(false, 0);
             SynchronizeSymbol(fontSize, lst);
         } else if (CSS.Value.LOWER_GREEK.Equals(styleType)) {
             lst = new GreekList(true, 0);
             SynchronizeSymbol(fontSize, lst);
         } else if (CSS.Value.UPPER_GREEK.Equals(styleType)) {
             lst = new GreekList(false, 0);
             SynchronizeSymbol(fontSize, lst);
         } else if (CSS.Value.LOWER_ALPHA.Equals(styleType) || CSS.Value.LOWER_LATIN.Equals(styleType)) {
             lst = new List(List.ORDERED, List.ALPHABETICAL);
             SynchronizeSymbol(fontSize, lst);
             lst.Lowercase = true;
         } else if (CSS.Value.UPPER_ALPHA.Equals(styleType) || CSS.Value.UPPER_LATIN.Equals(styleType)) {
             lst = new List(List.ORDERED, List.ALPHABETICAL);
             SynchronizeSymbol(fontSize, lst);
             lst.Lowercase = false;
         }
     } else if (Util.EqualsIgnoreCase(t.Name, HTML.Tag.OL)) {
         lst = new List(List.ORDERED);
         SynchronizeSymbol(fontSize, lst);
     } else if (Util.EqualsIgnoreCase(t.Name, HTML.Tag.UL)) {
         lst = new List(List.UNORDERED);
         ShrinkSymbol(lst, fontSize);
     }
     if (css.ContainsKey(CSS.Property.LIST_STYLE_IMAGE)
             && !Util.EqualsIgnoreCase(css[CSS.Property.LIST_STYLE_IMAGE], CSS.Value.NONE)) {
         lst = new List();
         String url = utils.ExtractUrl(css[CSS.Property.LIST_STYLE_IMAGE]);
         iTextSharp.text.Image img = null;
         try {
             if (htmlPipelineContext == null) {
                 img = new ImageRetrieve().RetrieveImage(url);
             } else {
                 try {
                     img = new ImageRetrieve(htmlPipelineContext.GetImageProvider()).RetrieveImage(url);
                 } catch (NoImageProviderException) {
                     if (LOG.IsLogging(Level.TRACE)) {
                         LOG.Trace(String.Format(LocaleMessages.GetInstance().GetMessage("pipeline.html.noimageprovider"), htmlPipelineContext.GetType().FullName));
                     }
                     img = new ImageRetrieve().RetrieveImage(url);
                 }
             }
             lst.ListSymbol = new Chunk(img, 0, 0, false);
             lst.SymbolIndent = img.Width;
             if (LOG.IsLogging(Level.TRACE)) {
                 LOG.Trace(String.Format(LocaleMessages.GetInstance().GetMessage("html.tag.list"), url));
             }
         } catch (IOException e) {
             if (LOG.IsLogging(Level.ERROR)) {
                 LOG.Error(String.Format(LocaleMessages.GetInstance().GetMessage("html.tag.list.failed"), url), e);
             }
             lst = new List(List.UNORDERED);
         } catch (NoImageException e) {
             if (LOG.IsLogging(Level.ERROR)) {
                 LOG.Error(e.Message, e);
             }
             lst = new List(List.UNORDERED);
         }
     }
     lst.Alignindent = false;
     lst.Autoindent = false;
     float leftIndent = 0;
     if (css.ContainsKey(CSS.Property.LIST_STYLE_POSITION) && Util.EqualsIgnoreCase(css[CSS.Property.LIST_STYLE_POSITION], CSS.Value.INSIDE)) {
         leftIndent += 30;
     } else {
         leftIndent += 15;
     }
     leftIndent += css.ContainsKey(CSS.Property.MARGIN_LEFT)?utils.ParseValueToPt(css[CSS.Property.MARGIN_LEFT],fontSize):0;
     leftIndent += css.ContainsKey(CSS.Property.PADDING_LEFT)?utils.ParseValueToPt(css[CSS.Property.PADDING_LEFT],fontSize):0;
     lst.IndentationLeft = leftIndent;
     return lst;
 }
Пример #4
0
        /* (non-Javadoc)
         * @see com.itextpdf.tool.xml.html.CssAppliers#apply(com.itextpdf.text.Element, com.itextpdf.tool.xml.Tag, com.itextpdf.tool.xml.pipeline.html.HtmlPipelineContext)
         */

        virtual public IElement Apply(IElement e, Tag t, HtmlPipelineContext ctx)
        {
            return this.Apply(e, t, ctx, ctx, ctx.GetImageProvider());
        }
Пример #5
0
 public IElement Apply(IElement e, Tag t, HtmlPipelineContext ctx) {
     try {
         return this.Apply(e, t, ctx, ctx, ctx.GetImageProvider());
     } catch (NoImageProviderException) {
         return this.Apply(e, t, ctx, ctx, null);
     }
 }