本文整理汇总了C#中iTextSharp.tool.xml.pipeline.html.HtmlPipelineContext.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlPipelineContext.GetType方法的具体用法?C# HtmlPipelineContext.GetType怎么用?C# HtmlPipelineContext.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.tool.xml.pipeline.html.HtmlPipelineContext
的用法示例。
在下文中一共展示了HtmlPipelineContext.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
/**
* 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;
}
//.........这里部分代码省略.........