| Constructor: |
PdfOutline(PdfWriter writer) {
// constructors
super(OUTLINES);
open = true;
parent = null;
this.writer = writer;
}
Parameters:
writer - The PdfWriter you are adding the outline to
|
public PdfOutline(PdfOutline parent,
PdfAction action,
String title) {
this(parent, action, title, true);
}
Parameters:
parent - the parent of this outline item
action - the PdfAction for this outline item
title - the title of this outline item
|
public PdfOutline(PdfOutline parent,
PdfDestination destination,
String title) {
this(parent, destination, title, true);
}
Parameters:
parent - the parent of this outline item
destination - the destination for this outline item
title - the title of this outline item
|
public PdfOutline(PdfOutline parent,
PdfAction action,
PdfString title) {
this(parent, action, title, true);
}
Parameters:
parent - the parent of this outline item
action - the PdfAction for this outline item
title - the title of this outline item
|
public PdfOutline(PdfOutline parent,
PdfDestination destination,
PdfString title) {
this(parent, destination, title, true);
}
Parameters:
parent - the parent of this outline item
destination - the destination for this outline item
title - the title of this outline item
|
public PdfOutline(PdfOutline parent,
PdfAction action,
Paragraph title) {
this(parent, action, title, true);
}
Parameters:
parent - the parent of this outline item
action - the PdfAction for this outline item
title - the title of this outline item
|
public PdfOutline(PdfOutline parent,
PdfDestination destination,
Paragraph title) {
this(parent, destination, title, true);
}
Parameters:
parent - the parent of this outline item
destination - the destination for this outline item
title - the title of this outline item
|
public PdfOutline(PdfOutline parent,
PdfAction action,
String title,
boolean open) {
super();
this.action = action;
initOutline(parent, title, open);
}
Parameters:
parent - the parent of this outline item
action - the PdfAction for this outline item
title - the title of this outline item
open - true if the children are visible
|
public PdfOutline(PdfOutline parent,
PdfDestination destination,
String title,
boolean open) {
super();
this.destination = destination;
initOutline(parent, title, open);
}
Parameters:
parent - the parent of this outline item
destination - the destination for this outline item
title - the title of this outline item
open - true if the children are visible
|
public PdfOutline(PdfOutline parent,
PdfAction action,
PdfString title,
boolean open) {
this(parent, action, title.toString(), open);
}
Parameters:
parent - the parent of this outline item
action - the PdfAction for this outline item
title - the title of this outline item
open - true if the children are visible
|
public PdfOutline(PdfOutline parent,
PdfDestination destination,
PdfString title,
boolean open) {
this(parent, destination, title.toString(), true);
}
Parameters:
parent - the parent of this outline item
destination - the destination for this outline item
title - the title of this outline item
open - true if the children are visible
|
public PdfOutline(PdfOutline parent,
PdfAction action,
Paragraph title,
boolean open) {
super();
StringBuffer buf = new StringBuffer();
for (Iterator i = title.getChunks().iterator(); i.hasNext(); ) {
Chunk chunk = (Chunk) i.next();
buf.append(chunk.getContent());
}
this.action = action;
initOutline(parent, buf.toString(), open);
}
Parameters:
parent - the parent of this outline item
action - the PdfAction for this outline item
title - the title of this outline item
open - true if the children are visible
|
public PdfOutline(PdfOutline parent,
PdfDestination destination,
Paragraph title,
boolean open) {
super();
StringBuffer buf = new StringBuffer();
for (Iterator i = title.getChunks().iterator(); i.hasNext(); ) {
Chunk chunk = (Chunk) i.next();
buf.append(chunk.getContent());
}
this.destination = destination;
initOutline(parent, buf.toString(), open);
}
Parameters:
parent - the parent of this outline item
destination - the destination for this outline item
title - the title of this outline item
open - true if the children are visible
|
| Method from com.lowagie.text.pdf.PdfOutline Detail: |
public void addKid(PdfOutline outline) {
kids.add(outline);
}
Adds a kid to the outline |
public Color getColor() {
return this.color;
}
Getter for property color. |
int getCount() {
return count;
}
|
public ArrayList getKids() {
return kids;
}
Returns the kids of this outline |
public PdfDestination getPdfDestination() {
return destination;
}
Gets the destination for this outline. |
public int getStyle() {
return this.style;
}
Getter for property style. |
public String getTag() {
return tag;
}
|
public String getTitle() {
PdfString title = (PdfString)get(PdfName.TITLE);
return title.toString();
}
Gets the title of this outline |
public PdfIndirectReference indirectReference() {
return reference;
}
Gets the indirect reference of this PdfOutline. |
void initOutline(PdfOutline parent,
String title,
boolean open) {
this.open = open;
this.parent = parent;
writer = parent.writer;
put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE));
parent.addKid(this);
if (destination != null && !destination.hasPage()) // bugfix Finn Bock
setDestinationPage(writer.getCurrentPage());
}
Helper for the constructors. |
public boolean isOpen() {
return open;
}
Getter for property open. |
public int level() {
if (parent == null) {
return 0;
}
return (parent.level() + 1);
}
returns the level of this outline. |
public PdfOutline parent() {
return parent;
}
Gets the parent of this PdfOutline. |
public void setColor(Color color) {
this.color = color;
}
Setter for property color. |
void setCount(int count) {
this.count = count;
}
|
public boolean setDestinationPage(PdfIndirectReference pageReference) {
if (destination == null) {
return false;
}
return destination.addPage(pageReference);
}
Set the page of the PdfDestination-object. |
public void setIndirectReference(PdfIndirectReference reference) {
this.reference = reference;
}
Sets the indirect reference of this PdfOutline. |
public void setKids(ArrayList kids) {
this.kids = kids;
}
Sets the kids of this outline |
public void setOpen(boolean open) {
this.open = open;
}
Setter for property open. |
public void setStyle(int style) {
this.style = style;
}
Setter for property style. |
public void setTag(String tag) {
this.tag = tag;
}
|
public void setTitle(String title) {
put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE));
}
Sets the title of this outline |
public void toPdf(PdfWriter writer,
OutputStream os) throws IOException {
if (color != null && !color.equals(Color.black)) {
put(PdfName.C, new PdfArray(new float[]{color.getRed()/255f,color.getGreen()/255f,color.getBlue()/255f}));
}
int flag = 0;
if ((style & Font.BOLD) != 0)
flag |= 2;
if ((style & Font.ITALIC) != 0)
flag |= 1;
if (flag != 0)
put(PdfName.F, new PdfNumber(flag));
if (parent != null) {
put(PdfName.PARENT, parent.indirectReference());
}
if (destination != null && destination.hasPage()) {
put(PdfName.DEST, destination);
}
if (action != null)
put(PdfName.A, action);
if (count != 0) {
put(PdfName.COUNT, new PdfNumber(count));
}
super.toPdf(writer, os);
}
Returns the PDF representation of this PdfOutline. |