Method from com.lowagie.text.Document Detail: |
public boolean add(Element element) throws DocumentException {
if (close) {
throw new DocumentException(
"The document has been closed. You can't add any Elements.");
}
if (!open && element.isContent()) {
throw new DocumentException(
"The document is not open yet; you can only add Meta information.");
}
boolean success = false;
DocListener listener;
if (element instanceof ChapterAutoNumber) {
chapternumber = ((ChapterAutoNumber)element).setAutomaticNumber(chapternumber);
}
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
success |= listener.add(element);
}
if (element instanceof LargeElement) {
LargeElement e = (LargeElement)element;
if (!e.isComplete())
e.flushContent();
}
return success;
}
Adds an Element to the Document . |
public boolean addAuthor(String author) {
try {
return add(new Meta(Element.AUTHOR, author));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}
Adds the author to a Document. |
public boolean addCreationDate() {
try {
/* bugfix by 'taqua' (Thomas) */
final SimpleDateFormat sdf = new SimpleDateFormat(
"EEE MMM dd HH:mm:ss zzz yyyy");
return add(new Meta(Element.CREATIONDATE, sdf.format(new Date())));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}
Adds the current date and time to a Document. |
public boolean addCreator(String creator) {
try {
return add(new Meta(Element.CREATOR, creator));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}
Adds the creator to a Document. |
public void addDocListener(DocListener listener) {
listeners.add(listener);
}
Adds a DocListener to the Document . |
public boolean addHeader(String name,
String content) {
try {
return add(new Header(name, content));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}
Adds a user defined header to the document. |
public boolean addKeywords(String keywords) {
try {
return add(new Meta(Element.KEYWORDS, keywords));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}
Adds the keywords to a Document. |
public boolean addProducer() {
try {
return add(new Meta(Element.PRODUCER, getVersion()));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}
Adds the producer to a Document. |
public boolean addSubject(String subject) {
try {
return add(new Meta(Element.SUBJECT, subject));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}
Adds the subject to a Document. |
public boolean addTitle(String title) {
try {
return add(new Meta(Element.TITLE, title));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}
Adds the title to a Document. |
public float bottom() {
return pageSize.getBottom(marginBottom);
}
Returns the lower left y-coordinate. |
public float bottom(float margin) {
return pageSize.getBottom(marginBottom + margin);
}
Returns the lower left y-coordinate, considering a given margin. |
public float bottomMargin() {
return marginBottom;
}
Returns the bottom margin. |
public void close() {
if (!close) {
open = false;
close = true;
}
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.close();
}
}
Closes the document.
Once all the content has been written in the body, you have to close the
body. After that nothing can be written to the body anymore. |
public String getHtmlStyleClass() {
return this.htmlStyleClass;
}
Gets the style class of the HTML body tag |
public String getJavaScript_onLoad() {
return this.javaScript_onLoad;
}
Gets the JavaScript onLoad command. |
public String getJavaScript_onUnLoad() {
return this.javaScript_onUnLoad;
}
Gets the JavaScript onUnLoad command. |
public int getPageNumber() {
return this.pageN;
}
Returns the current page number. |
public Rectangle getPageSize() {
return this.pageSize;
}
|
public static final String getProduct() {
return ITEXT;
}
Gets the product name.
This method may only be changed by Paulo Soares and/or Bruno Lowagie. |
public static final String getRelease() {
return RELEASE;
}
Gets the release number.
This method may only be changed by Paulo Soares and/or Bruno Lowagie. |
public static final String getVersion() {
return ITEXT_VERSION;
}
Gets the iText version.
This method may only be changed by Paulo Soares and/or Bruno Lowagie. |
public boolean isMarginMirroring() {
return marginMirroring;
}
Gets the margin mirroring flag. |
public boolean isOpen() {
return open;
}
Checks if the document is open. |
public float left() {
return pageSize.getLeft(marginLeft);
}
Returns the lower left x-coordinate. |
public float left(float margin) {
return pageSize.getLeft(marginLeft + margin);
}
Returns the lower left x-coordinate considering a given margin. |
public float leftMargin() {
return marginLeft;
}
|
public boolean newPage() {
if (!open || close) {
return false;
}
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.newPage();
}
return true;
}
Signals that an new page has to be started. |
public void open() {
if (!close) {
open = true;
}
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.setPageSize(pageSize);
listener.setMargins(marginLeft, marginRight, marginTop,
marginBottom);
listener.open();
}
}
Opens the document.
Once the document is opened, you can't write any Header- or
Meta-information anymore. You have to open the document before you can
begin to add content to the body of the document. |
public void removeDocListener(DocListener listener) {
listeners.remove(listener);
}
Removes a DocListener from the Document . |
public void resetFooter() {
this.footer = null;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.resetFooter();
}
}
Resets the footer of this document. |
public void resetHeader() {
this.header = null;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.resetHeader();
}
}
Resets the header of this document. |
public void resetPageCount() {
pageN = 0;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.resetPageCount();
}
}
Sets the page number to 0. |
public float right() {
return pageSize.getRight(marginRight);
}
Returns the upper right x-coordinate. |
public float right(float margin) {
return pageSize.getRight(marginRight + margin);
}
Returns the upper right x-coordinate, considering a given margin. |
public float rightMargin() {
return marginRight;
}
|
public void setFooter(HeaderFooter footer) {
this.footer = footer;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.setFooter(footer);
}
}
Changes the footer of this document. |
public void setHeader(HeaderFooter header) {
this.header = header;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.setHeader(header);
}
}
Changes the header of this document. |
public void setHtmlStyleClass(String htmlStyleClass) {
this.htmlStyleClass = htmlStyleClass;
}
Adds a style class to the HTML body tag |
public void setJavaScript_onLoad(String code) {
this.javaScript_onLoad = code;
}
Adds a JavaScript onLoad function to the HTML body tag |
public void setJavaScript_onUnLoad(String code) {
this.javaScript_onUnLoad = code;
}
Adds a JavaScript onUnLoad function to the HTML body tag |
public boolean setMarginMirroring(boolean marginMirroring) {
this.marginMirroring = marginMirroring;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.setMarginMirroring(marginMirroring);
}
return true;
}
|
public boolean setMarginMirroringTopBottom(boolean marginMirroringTopBottom) {
this.marginMirroringTopBottom = marginMirroringTopBottom;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.setMarginMirroringTopBottom(marginMirroringTopBottom);
}
return true;
}
|
public boolean setMargins(float marginLeft,
float marginRight,
float marginTop,
float marginBottom) {
this.marginLeft = marginLeft;
this.marginRight = marginRight;
this.marginTop = marginTop;
this.marginBottom = marginBottom;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.setMargins(marginLeft, marginRight, marginTop,
marginBottom);
}
return true;
}
|
public void setPageCount(int pageN) {
this.pageN = pageN;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.setPageCount(pageN);
}
}
|
public boolean setPageSize(Rectangle pageSize) {
this.pageSize = pageSize;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.setPageSize(pageSize);
}
return true;
}
|
public float top() {
return pageSize.getTop(marginTop);
}
Returns the upper right y-coordinate. |
public float top(float margin) {
return pageSize.getTop(marginTop + margin);
}
Returns the upper right y-coordinate, considering a given margin. |
public float topMargin() {
return marginTop;
}
|