|
|
@ -832,6 +832,21 @@ public class PdfChunk { |
|
|
|
|
|
|
|
|
|
|
|
public String toHtmlString() { |
|
|
|
public String toHtmlString() { |
|
|
|
StringBuffer htmlString = new StringBuffer(); |
|
|
|
StringBuffer htmlString = new StringBuffer(); |
|
|
|
|
|
|
|
String hyperlink =getHyperlink(); |
|
|
|
|
|
|
|
if (null != hyperlink && hyperlink.length() > 0) { |
|
|
|
|
|
|
|
htmlString.append("<a style='"); |
|
|
|
|
|
|
|
htmlString.append(getStyleAttributes()).append("'"); |
|
|
|
|
|
|
|
htmlString.append(" href='").append(hyperlink).append("'>"); |
|
|
|
|
|
|
|
if (this.isImage()) { |
|
|
|
|
|
|
|
htmlString.append("<img src='").append(image.getSrcString()).append("'"). |
|
|
|
|
|
|
|
append(" style='width:").append(image.getPlainWidth()).append("px"). |
|
|
|
|
|
|
|
append(" height:").append(image.getPlainHeight()).append("px'").append("/>"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
htmlString.append(value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
htmlString.append("</a>"); |
|
|
|
|
|
|
|
return htmlString.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
if (this.isImage()) { |
|
|
|
if (this.isImage()) { |
|
|
|
htmlString.append("<img src='").append(image.getSrcString()).append("'"). |
|
|
|
htmlString.append("<img src='").append(image.getSrcString()).append("'"). |
|
|
|
append(" style='width:").append(image.getPlainWidth()).append("px"). |
|
|
|
append(" style='width:").append(image.getPlainWidth()).append("px"). |
|
|
@ -847,6 +862,15 @@ public class PdfChunk { |
|
|
|
return htmlString.toString(); |
|
|
|
return htmlString.toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getHyperlink() { |
|
|
|
|
|
|
|
Object obj = this.getAttribute(Chunk.ACTION); |
|
|
|
|
|
|
|
if (null == obj || !(obj instanceof PdfAction)) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
PdfObject pdfObj = ((PdfAction) obj).get(PdfName.URI); |
|
|
|
|
|
|
|
return null == pdfObj ? null : pdfObj.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String getStyleAttributes(){ |
|
|
|
private String getStyleAttributes(){ |
|
|
|
StringBuffer stringBuffer = new StringBuffer(); |
|
|
|
StringBuffer stringBuffer = new StringBuffer(); |
|
|
|
dealFontStyle(stringBuffer, font.getOriFont()); |
|
|
|
dealFontStyle(stringBuffer, font.getOriFont()); |
|
|
|