Browse Source

REPORT-32592 html 以<a>、<br> or <hr> 标签开头时,丢失line-height属性

release/10.0
Hugh.C 5 years ago
parent
commit
a0304dcde3
  1. 12
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java

12
fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java

@ -228,7 +228,8 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener {
if (tag.equals(HtmlTags.ANCHOR)) { if (tag.equals(HtmlTags.ANCHOR)) {
cprops.addToChain(tag, h); cprops.addToChain(tag, h);
if (currentParagraph == null) { if (currentParagraph == null) {
currentParagraph = new Paragraph(); currentParagraph = FactoryProperties
.createParagraph(cprops);
} }
stack.push(currentParagraph); stack.push(currentParagraph);
currentParagraph = new Paragraph(); currentParagraph = new Paragraph();
@ -236,7 +237,8 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener {
} }
if (tag.equals(HtmlTags.NEWLINE)) { if (tag.equals(HtmlTags.NEWLINE)) {
if (currentParagraph == null) { if (currentParagraph == null) {
currentParagraph = new Paragraph(); currentParagraph = FactoryProperties
.createParagraph(cprops);
} }
currentParagraph.add(factoryProperties currentParagraph.add(factoryProperties
.createChunk("\n", cprops)); .createChunk("\n", cprops));
@ -249,7 +251,8 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener {
// end with a break, but a trailing break is always inserted. // end with a break, but a trailing break is always inserted.
boolean addLeadingBreak = true; boolean addLeadingBreak = true;
if (currentParagraph == null) { if (currentParagraph == null) {
currentParagraph = new Paragraph(); currentParagraph = FactoryProperties
.createParagraph(cprops);
addLeadingBreak = false; addLeadingBreak = false;
} }
if (addLeadingBreak) { // Not a new paragraph if (addLeadingBreak) { // Not a new paragraph
@ -545,7 +548,8 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener {
} }
if (tag.equals("a")) { if (tag.equals("a")) {
if (currentParagraph == null) { if (currentParagraph == null) {
currentParagraph = new Paragraph(); currentParagraph = FactoryProperties
.createParagraph(cprops);
} }
boolean skip = false; boolean skip = false;
if (interfaceProps != null) { if (interfaceProps != null) {

Loading…
Cancel
Save