Add check for no image in Draw parser
This commit is contained in:
parent
f0a377345e
commit
de9dc7e456
1 changed files with 19 additions and 14 deletions
|
@ -597,20 +597,25 @@ public class DrawParser extends Parser {
|
|||
}
|
||||
}
|
||||
else {
|
||||
// In all other cases, create an img element
|
||||
if (bgd!=null && !bgd.isLinked() && !bgd.isRecycled() && !bEmbedImg) { converter.addDocument(bgd); }
|
||||
Element image = converter.createElement("img");
|
||||
String sName = Misc.getAttribute(getFrame(onode),XMLString.DRAW_NAME);
|
||||
converter.addTarget(image,sName+"|graphic");
|
||||
if (!bEmbedImg || bgd.isLinked()) {
|
||||
image.setAttribute("src",sFileName);
|
||||
}
|
||||
else {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("data:").append(bgd.getMIMEType()).append(";base64,")
|
||||
.append(DatatypeConverter.printBase64Binary(bgd.getData()));
|
||||
image.setAttribute("src", buf.toString());
|
||||
}
|
||||
// In all other cases, create an img element
|
||||
if (bgd != null && !bgd.isLinked() && !bgd.isRecycled() && !bEmbedImg) {
|
||||
converter.addDocument(bgd);
|
||||
}
|
||||
Element image = converter.createElement("img");
|
||||
String sName = Misc.getAttribute(getFrame(onode), XMLString.DRAW_NAME);
|
||||
converter.addTarget(image, sName + "|graphic");
|
||||
if (!bEmbedImg || bgd.isLinked()) {
|
||||
image.setAttribute("src", sFileName);
|
||||
} else {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("data:");
|
||||
buf.append(bgd.getMIMEType());
|
||||
buf.append(";base64,");
|
||||
if (bgd.getData() != null) {
|
||||
buf.append(DatatypeConverter.printBase64Binary(bgd.getData()));
|
||||
}
|
||||
image.setAttribute("src", buf.toString());
|
||||
}
|
||||
// Add alternative text, using either alt.text, name or file name
|
||||
Element desc = Misc.getChildByTagName(frame,XMLString.SVG_DESC);
|
||||
if (desc==null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue