Example usage for com.itextpdf.text TextElementArray add

List of usage examples for com.itextpdf.text TextElementArray add

Introduction

In this page you can find the example usage for com.itextpdf.text TextElementArray add.

Prototype

public boolean add(Element element);

Source Link

Document

Adds an element to the TextElementArray.

Usage

From source file:com.masscustsoft.service.ToPdf.java

License:Open Source License

/**
 * Flushes the current paragraph, indicating that we're starting
 * a new block./*from   ww  w . java  2 s.c o m*/
 * If the stack is empty, the paragraph is added to the document.
 * Otherwise the Paragraph is added to the stack.
 * @since 5.0.6
 */
public void carriageReturn() throws DocumentException {
    if (currentParagraph == null)
        return;
    if (stack.empty())
        document.add(currentParagraph);
    else {
        Element obj = stack.pop();
        if (obj instanceof TextElementArray) {
            TextElementArray current = (TextElementArray) obj;
            current.add(currentParagraph);
        }
        stack.push(obj);
    }
    currentParagraph = null;
}