diff --git a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java index 39b06af14..5e68ef341 100644 --- a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java +++ b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java @@ -86,7 +86,6 @@ public class FactoryProperties { public Chunk createChunk(String text, ChainedProperties props) { Font font = getFont(props); - dealHyperlinkfont( font, props); float size = font.getSize(); size /= 3; Chunk ck = new Chunk(text, font); @@ -107,31 +106,6 @@ public class FactoryProperties { return ck; } - /** - * 处理超链接的字体颜色和下划线 - * - * @param font - * @param props - */ - private static void dealHyperlinkfont(Font font, ChainedProperties props) { - String tagName = props.getLastTag(); - if (null == tagName || tagName.equals("") || !tagName.equals(HtmlTags.ANCHOR)) { - return; - } - int style = font.getStyle(); - if (props.hasKvInLastChain(CSS.Property.TEXT_DECORATION, CSS.Value.NONE)) { - //含有 text-decoration 属性,且值为 none时,将下划线属性去掉 - font.setStyle(style & (~Font.UNDERLINE)); - } else { - //默认是有需要有下划线的 - font.setStyle(style | Font.UNDERLINE); - } - //没有指定颜色 or 是继承的颜色(标签不需要继承颜色,只使用自身的颜色)时,使用默认的蓝色(超链接) - if (null == font.getColor() || (!font.getColor().equals(Color.BLUE) && null == props.getLastChainProperty(CSS.Property.COLOR))) { - font.setColor(Color.BLUE); - } - } - private static void setParagraphLeading(Paragraph p, String leading) { if (leading == null) { p.setLeading(0, 1.5f); diff --git a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java index a1a9da464..9bce7242f 100644 --- a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java +++ b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java @@ -218,6 +218,10 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener { if (tag.equals("th")) { h.put("b", null); } + if (tag.equals(HtmlTags.ANCHOR)) { + h.put("u", null); + h.put("color", "blue"); + } String follow = (String) FactoryProperties.followTags.get(tag); if (follow != null) { HashMap prop = new HashMap();