File fcover=new File(getCoverPath());
if(fcover.exists()){
try {
HTMLElement covelem=getCoverResource().getDocument().createElement("div");
Resource r=addImage(fcover.getAbsolutePath(), covelem,getCoverResource());
if(r!=null){
r.setId("cover-image");
getEpub().addMetadata(null, "cover", "cover-image");
//
covelem.setClassName("cover");
Selector selector = getStylesheet().getSimpleSelector("div", "cover");
SelectorRule rule = getStylesheet().getRuleForSelector(selector, true);
rule.set("width", new CSSName("100%"));
rule.set("text-align", new CSSName("center"));
getCoverResource().getDocument().getBody().add(covelem);