Example usage for com.lowagie.text Anchor getName

List of usage examples for com.lowagie.text Anchor getName

Introduction

In this page you can find the example usage for com.lowagie.text Anchor getName.

Prototype

public String getName() 

Source Link

Document

Returns the name of this Anchor.

Usage

From source file:com.amphisoft.epub2pdf.content.XhtmlHandler.java

License:Open Source License

private void addAnchorToBookmarks(Anchor a) {
    if (sourceEpub != null && bookmarkRoot != null && a.getReference() == null && a.getName() != null) {
        String aName = a.getName();
        addToBookmarks(currentFile, aName);
    }//from w  w w  .  jav a 2  s .c om
}

From source file:com.amphisoft.epub2pdf.content.XhtmlHandler.java

License:Open Source License

static String getAbridgedContents(Element elem) {
    String content = "";
    if (elem != null)
        content += elem.toString();/*from   w w  w. j  a  v  a2s.  c o m*/
    int len = content.length();
    if (len > 25) {
        StringBuilder sB = new StringBuilder();
        sB.append(content.substring(0, 10));
        sB.append(" ... ");
        sB.append(content.substring(len - 10));
        content = sB.toString();
    }
    if (elem instanceof Anchor) {
        Anchor elemAnchor = (Anchor) elem;
        StringBuilder sB = new StringBuilder();
        sB.append('_');
        sB.append(elemAnchor.getName());
        if (elemAnchor.getReference() != null) {
            sB.append("->");
            sB.append(elemAnchor.getReference());
        }
        sB.append(":");
        sB.append(content);
        content = sB.toString();
    }
    return content;
}