Browse Source

REPORT-10262 html大文本精确分页

research/11.0
kerry 6 years ago
parent
commit
804ca8cf58
  1. 4
      fine-itext/src/com/fr/third/v2/lowagie/text/html/Markup.java
  2. 4
      fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java
  3. 2
      fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfChunk.java
  4. 2
      fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfLine.java

4
fine-itext/src/com/fr/third/v2/lowagie/text/html/Markup.java

@ -449,9 +449,9 @@ public class Markup {
if (part.length == 2) { if (part.length == 2) {
key = stripDoubleSpacesAndTrim(part[0]).toLowerCase(); key = stripDoubleSpacesAndTrim(part[0]).toLowerCase();
value = stripDoubleSpacesAndTrim(part[1]); value = stripDoubleSpacesAndTrim(part[1]);
if (value.startsWith("\"")) if (value.startsWith("\"") || value.startsWith("\'") )
value = value.substring(1); value = value.substring(1);
if (value.endsWith("\"")) if (value.endsWith("\"") || value.endsWith("\'"))
value = value.substring(0, value.length() - 1); value = value.substring(0, value.length() - 1);
result.setProperty(key.toLowerCase(), value); result.setProperty(key.toLowerCase(), value);
} }

4
fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java

@ -137,6 +137,9 @@ public class FactoryProperties {
if(props.hasPropertyInChain("div", "background")){ if(props.hasPropertyInChain("div", "background")){
p.setBackground(props.getPropertyFromChain("div", "background")); p.setBackground(props.getPropertyFromChain("div", "background"));
} }
if(props.hasProperty("line-height")){
p.setAttribute("line-height", props.getProperty("line-height"));
}
for(String margin : HtmlConstants.MARGIN){ for(String margin : HtmlConstants.MARGIN){
if(props.hasPropertyInChain("div", margin)){ if(props.hasPropertyInChain("div", margin)){
String ss = props.getPropertyFromChain("div", margin); String ss = props.getPropertyFromChain("div", margin);
@ -419,6 +422,7 @@ public class FactoryProperties {
return; return;
} }
h.put("leading", v + ",0"); h.put("leading", v + ",0");
h.put("line-height", ss);
} else if (key.equals(Markup.CSS_KEY_TEXTALIGN)) { } else if (key.equals(Markup.CSS_KEY_TEXTALIGN)) {
String ss = prop.getProperty(key).trim().toLowerCase(); String ss = prop.getProperty(key).trim().toLowerCase();
h.put("align", ss); h.put("align", ss);

2
fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfChunk.java

@ -394,7 +394,7 @@ public class PdfChunk {
} }
// otherwise, the string has to be truncated // otherwise, the string has to be truncated
String returnValue = value.substring(start); String returnValue = value.substring(start);
value = trim(value.substring(0, start)); value = value.substring(0, start);
PdfChunk pc = new PdfChunk(returnValue, this); PdfChunk pc = new PdfChunk(returnValue, this);
return pc; return pc;
} }

2
fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfLine.java

@ -176,8 +176,6 @@ public class PdfLine {
} }
// if the length of the chunk > 0 we add it to the line // if the length of the chunk > 0 we add it to the line
else if (chunk.length() > 0 || chunk.isImage()) { else if (chunk.length() > 0 || chunk.isImage()) {
if (overflow != null)
chunk.trimLastSpace();
width -= chunk.width(); width -= chunk.width();
addToLine(chunk); addToLine(chunk);
} }

Loading…
Cancel
Save