Example usage for com.lowagie.text Anchor getReference

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

Introduction

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

Prototype

public String getReference() 

Source Link

Document

Gets the reference 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 .  j  av a  2s  .  c o m
}

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();//w w  w. j a  v a  2 s . 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;
}