org.faceless.pdf2
Class AnnotationStamp

java.lang.Object
  extended byorg.faceless.pdf2.PDFObject
      extended byorg.faceless.pdf2.PDFMap
          extended byorg.faceless.pdf2.PDFAnnotation
              extended byorg.faceless.pdf2.AnnotationStamp
All Implemented Interfaces:
Cloneable

public final class AnnotationStamp
extends PDFAnnotation

A "Rubber-Stamp" annotation, which can also contain a longer message in an associated pop-up window. A number of predefined rubber stamps exist, or for custom stamps they can be created from a PDFCanvas object. For example, to add a rubber stamp to page, try something like this:

   AnnotationStamp stamp = new AnnotationStamp("stamp.standard.Approved", 1);
   float x = page.getWidth()/2;
   float y = page.getHeight()/2;
   float w = stamp.getRecommendedWidth();
   float h = stamp.getRecommendedHeight();

   stamp.setRectangle(x-(w/2), y-(h/2), x+(w/2), y+(h/2));
   page.addAnnotation(stamp);
 

Since:
2.0

Constructor Summary
AnnotationStamp(String type, float opacity)
          Create a rubber-stamp annotation which can be added to the page.
AnnotationStamp(String name, PDFCanvas canvas)
          Create a new Stamp from the specified canvas
 
Method Summary
 String getAuthor()
          Return the author (or "Label") of the annotation
 String getContents()
          Return the contents of the notes' pop-up window, as set by setContents(java.lang.String)
 float getRecommendedHeight()
          Return the recommended height of this stamp
 float getRecommendedWidth()
          Return the recommended width of this stamp
 String getType()
          Returns the type of Stamp used.
 void setAuthor(String label)
          Set the author of the annotation.
 void setContents(String contents)
          Set the contents pop-up window displayed when the annotation is open.
 
Methods inherited from class org.faceless.pdf2.PDFAnnotation
equals, getCreationDate, getInReplyTo, getModifyDate, getPage, getRectangle, getSubject, getUniqueID, isPrintable, isReadOnly, isVisible, setInReplyTo, setPage, setPrintable, setReadOnly, setRectangle, setSubject, setUniqueID, setVisible, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotationStamp

public AnnotationStamp(String type,
                       float opacity)
Create a rubber-stamp annotation which can be added to the page. A number of predefined stamps are available:
stamp.stencil.ApprovedThe word "Approved" in a rubber-stamp style
stamp.stencil.AsIsThe words "As Is" in a rubber-stamp style
stamp.stencil.ConfidentialThe word "Confidential" in a rubber-stamp style
stamp.stencil.DepartmentalThe word "Departmental" in a rubber-stamp style
stamp.stencil.DraftThe word "Draft" in a rubber-stamp style
stamp.stencil.ExperimentalThe word "Experimental" in a rubber-stamp style
stamp.stencil.ExpiredThe word "Expired" in a rubber-stamp style
stamp.stencil.FinalThe word "Final" in a rubber-stamp style
stamp.stencil.ForCommentThe words "For Comment" in a rubber-stamp style
stamp.stencil.ForPublicReleaseThe words "For Public Release" in a rubber-stamp style
stamp.stencil.NotApprovedThe words "Not Approved" in a rubber-stamp style
stamp.stencil.NotForPublicReleaseThe words "Not For Public Release" in a rubber-stamp style
stamp.stencil.SoldThe words "As Is" in a rubber-stamp style
stamp.stencil.TopSecretThe words "Top Secret" in a rubber-stamp style
stamp.standard.ApprovedThe word "Approved" inside a box
stamp.standard.CompletedThe word "Completed" inside a box
stamp.standard.ConfidentialThe word "Confidential" inside a box
stamp.standard.DraftThe word "Draft" inside a box
stamp.standard.FinalThe word "Final" inside a box
stamp.standard.ForCommentThe words "For Comment" inside a box
stamp.standard.ForPublicReleaseThe words "For Public Release" inside a box
stamp.standard.InformationOnlyThe words "Information Only" inside a box
stamp.standard.NotApprovedThe words "Not Approved" inside a box
stamp.standard.NotForPublicReleaseThe words "Not For Public Release" inside a box
stamp.standard.PreliminaryResultsThe words "Preliminary Results" inside a box
stamp.standard.VoidThe word "Void" inside a box
Alternatively a custom stamp may be created and loaded from a resource file. As well as the fields specified in the PDFCanvas.PDFCanvas(String,float) constructor, the resource file should define the "name" property, which is the name of the stamp.

Parameters:
type - the type of stamp - one of the values listed above or the name of a resource file
opacity - the opacity of the stamp - anywhere between 0 (for transparent) and 1 (for opaque). Note that transparency was only added in Acrobat 5, so earlier viewers will ignore this setting.
Throws:
IllegalArgumentException - if the stamp type is unknown
Since:
2.0

AnnotationStamp

public AnnotationStamp(String name,
                       PDFCanvas canvas)
Create a new Stamp from the specified canvas

Parameters:
name - the name of the stamp
canvas - the canvas to use as the body of the stamp
Since:
2.0
Method Detail

getType

public String getType()
Returns the type of Stamp used. This will probably be a textual description of the contents of the stamp, but is not guaranteed to be.

Overrides:
getType in class PDFAnnotation

getRecommendedWidth

public float getRecommendedWidth()
Return the recommended width of this stamp


getRecommendedHeight

public float getRecommendedHeight()
Return the recommended height of this stamp


setAuthor

public void setAuthor(String label)
Set the author of the annotation. This is also sometimes referred to as the Label.


getAuthor

public String getAuthor()
Return the author (or "Label") of the annotation


setContents

public void setContents(String contents)
Set the contents pop-up window displayed when the annotation is open.

Parameters:
contents - the contents of the window - may contain newline and non-ASCII Unicode characters.

getContents

public String getContents()
Return the contents of the notes' pop-up window, as set by setContents(java.lang.String)



Copyright © 2001-2004 Big Faceless Organization