use of com.lowagie.text.rtf.document.RtfDocument in project itext2 by albfernandez.
the class RtfDestinationInfo method handleCloseGroup.
/* (non-Javadoc)
* @see com.lowagie.text.rtf.direct.RtfDestination#handleGroupEnd()
*/
public boolean handleCloseGroup() {
if (this.text.length() > 0) {
Document doc = this.rtfParser.getDocument();
if (doc != null) {
if (this.elementName.equals("author")) {
doc.addAuthor(this.text);
}
if (this.elementName.equals("title")) {
doc.addTitle(this.text);
}
if (this.elementName.equals("subject")) {
doc.addSubject(this.text);
}
} else {
RtfDocument rtfDoc = this.rtfParser.getRtfDocument();
if (rtfDoc != null) {
if (this.elementName.equals("author")) {
Meta meta = new Meta(this.elementName, this.text);
RtfInfoElement elem = new RtfInfoElement(rtfDoc, meta);
rtfDoc.getDocumentHeader().addInfoElement(elem);
}
if (this.elementName.equals("title")) {
Meta meta = new Meta(this.elementName, this.text);
RtfInfoElement elem = new RtfInfoElement(rtfDoc, meta);
rtfDoc.getDocumentHeader().addInfoElement(elem);
}
if (this.elementName.equals("subject")) {
Meta meta = new Meta(this.elementName, this.text);
RtfInfoElement elem = new RtfInfoElement(rtfDoc, meta);
rtfDoc.getDocumentHeader().addInfoElement(elem);
}
}
}
this.setToDefaults();
}
return true;
}
use of com.lowagie.text.rtf.document.RtfDocument in project itext2 by albfernandez.
the class RtfWriter2 method close.
/**
* Closes the RtfDocument. This causes the document to be written
* to the specified OutputStream
*/
public void close() {
if (open) {
rtfDoc.writeDocument(os);
super.close();
this.rtfDoc = new RtfDocument();
}
}
use of com.lowagie.text.rtf.document.RtfDocument in project itext2 by albfernandez.
the class RtfParser method outputDebug.
public static void outputDebug(Object doc, int groupLevel, String str) {
System.out.println(str);
if (doc == null)
return;
if (groupLevel < 0)
groupLevel = 0;
char[] a;
Arrays.fill(a = new char[groupLevel * 2], ' ');
String spaces = new String(a);
if (doc instanceof RtfDocument) {
((RtfDocument) doc).add(new RtfDirectContent("\n" + spaces + str));
} else if (doc instanceof Document) {
try {
((Document) doc).add(new RtfDirectContent("\n" + spaces + str));
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Aggregations