gnu.jpdf
Class PDFAnnot

java.lang.Object
  extended by gnu.jpdf.PDFObject
      extended by gnu.jpdf.PDFAnnot
All Implemented Interfaces:
java.io.Serializable

public class PDFAnnot
extends PDFObject
implements java.io.Serializable

This class defines an annotation (commonly known as a Bookmark).

See Also:
Serialized Form

Field Summary
static short BEVELED
          The border is drawn in a beveled style (faux three-dimensional) such that it looks as if it is pushed out of the page (opposite of INSET)
static short DASHED
          The border is drawn with a dashed line.
static short INSET
          The border is drawn in an inset style (faux three-dimensional) such that it looks as if it is inset into the page (opposite of BEVELED)
static short SOLID
          Solid border.
static short UNDERLINED
          The border is drawn as a line on the bottom of the annotation rectangle
 
Fields inherited from class gnu.jpdf.PDFObject
objser, pdfDocument
 
Constructor Summary
  PDFAnnot(int l, int b, int r, int t, PDFObject dest)
          Creates a link annotation
  PDFAnnot(int l, int b, int r, int t, PDFObject dest, int fl, int fb, int fr, int ft)
          Creates a link annotation
  PDFAnnot(int l, int b, int r, int t, java.lang.String s)
          Creates a text annotation
protected PDFAnnot(java.lang.String s, int l, int b, int r, int t)
          This is used to create an annotation.
 
Method Summary
 void setBorder(double width, double[] dash)
          Sets the border for the annotation.
 void setBorder(short style, double width)
          Sets the border for the annotation.
 void write(java.io.OutputStream os)
          Should this be public??
 
Methods inherited from class gnu.jpdf.PDFObject
getPDFDocument, getSerialID, getType, toArray, toString, writeEnd, writeStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SOLID

public static final short SOLID
Solid border. The border is drawn as a solid line.

See Also:
Constant Field Values

DASHED

public static final short DASHED
The border is drawn with a dashed line.

See Also:
Constant Field Values

BEVELED

public static final short BEVELED
The border is drawn in a beveled style (faux three-dimensional) such that it looks as if it is pushed out of the page (opposite of INSET)

See Also:
Constant Field Values

INSET

public static final short INSET
The border is drawn in an inset style (faux three-dimensional) such that it looks as if it is inset into the page (opposite of BEVELED)

See Also:
Constant Field Values

UNDERLINED

public static final short UNDERLINED
The border is drawn as a line on the bottom of the annotation rectangle

See Also:
Constant Field Values
Constructor Detail

PDFAnnot

protected PDFAnnot(java.lang.String s,
                   int l,
                   int b,
                   int r,
                   int t)
This is used to create an annotation.

Parameters:
s - Subtype for this annotation
l - Left coordinate
b - Bottom coordinate
r - Right coordinate
t - Top coordinate

PDFAnnot

public PDFAnnot(int l,
                int b,
                int r,
                int t,
                java.lang.String s)
Creates a text annotation

Parameters:
l - Left coordinate
b - Bottom coordinate
r - Right coordinate
t - Top coordinate
s - Text for this annotation

PDFAnnot

public PDFAnnot(int l,
                int b,
                int r,
                int t,
                PDFObject dest)
Creates a link annotation

Parameters:
l - Left coordinate
b - Bottom coordinate
r - Right coordinate
t - Top coordinate
dest - Destination for this link. The page will fit the display.

PDFAnnot

public PDFAnnot(int l,
                int b,
                int r,
                int t,
                PDFObject dest,
                int fl,
                int fb,
                int fr,
                int ft)
Creates a link annotation

Parameters:
l - Left coordinate
b - Bottom coordinate
r - Right coordinate
t - Top coordinate
dest - Destination for this link
fl - Left coordinate
fb - Bottom coordinate
fr - Right coordinate
ft - Top coordinate (must be in User Coordinates)
Method Detail

setBorder

public void setBorder(short style,
                      double width)
Sets the border for the annotation. By default, no border is defined.

If the style is DASHED, then this method uses PDF's default dash scheme {3}

Important: the annotation must have been added to the document before this is used. If the annotation was created using the methods in PDFPage, then the annotation is already in the document.

Parameters:
style - Border style SOLID, DASHED, BEVELED, INSET or UNDERLINED.
width - Width of the border

setBorder

public void setBorder(double width,
                      double[] dash)
Sets the border for the annotation. Unlike the other method, this produces a dashed border.

Important: the annotation must have been added to the document before this is used. If the annotation was created using the methods in PDFPage, then the annotation is already in the document.

Parameters:
width - Width of the border
dash - Array of lengths, used for drawing the dashes. If this is null, then the default of {3} is used.

write

public void write(java.io.OutputStream os)
           throws java.io.IOException
Should this be public??

Specified by:
write in class PDFObject
Parameters:
os - OutputStream to send the object to
Throws:
java.io.IOException - on error