001: /**
002: * Copyright (c) 2003, www.pdfbox.org
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms, with or without
006: * modification, are permitted provided that the following conditions are met:
007: *
008: * 1. Redistributions of source code must retain the above copyright notice,
009: * this list of conditions and the following disclaimer.
010: * 2. Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: * 3. Neither the name of pdfbox; nor the names of its
014: * contributors may be used to endorse or promote products derived from this
015: * software without specific prior written permission.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
018: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
019: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
020: * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
021: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
022: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
023: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
024: * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
026: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027: *
028: * http://www.pdfbox.org
029: *
030: */package org.pdfbox.pdmodel.interactive.annotation;
031:
032: import org.pdfbox.cos.COSDictionary;
033: import org.pdfbox.cos.COSName;
034:
035: /**
036: * This is the class that represents a rubber stamp annotation.
037: * Introduced in PDF 1.3 specification
038: *
039: * @author Paul King
040: * @version $Revision: 1.2 $
041: */
042: public class PDAnnotationRubberStamp extends PDAnnotationMarkup {
043:
044: /*
045: * The various values of the rubber stamp as defined in
046: * the PDF 1.6 reference Table 8.28
047: */
048:
049: /**
050: * Constant for the name of a rubber stamp.
051: */
052: public static final String NAME_APPROVED = "Approved";
053: /**
054: * Constant for the name of a rubber stamp.
055: */
056: public static final String NAME_EXPERIMENTAL = "Experimental";
057: /**
058: * Constant for the name of a rubber stamp.
059: */
060: public static final String NAME_NOT_APPROVED = "NotApproved";
061: /**
062: * Constant for the name of a rubber stamp.
063: */
064: public static final String NAME_AS_IS = "AsIs";
065: /**
066: * Constant for the name of a rubber stamp.
067: */
068: public static final String NAME_EXPIRED = "Expired";
069: /**
070: * Constant for the name of a rubber stamp.
071: */
072: public static final String NAME_NOT_FOR_PUBLIC_RELEASE = "NotForPublicRelease";
073: /**
074: * Constant for the name of a rubber stamp.
075: */
076: public static final String NAME_FOR_PUBLIC_RELEASE = "ForPublicRelease";
077: /**
078: * Constant for the name of a rubber stamp.
079: */
080: public static final String NAME_DRAFT = "Draft";
081: /**
082: * Constant for the name of a rubber stamp.
083: */
084: public static final String NAME_FOR_COMMENT = "ForComment";
085: /**
086: * Constant for the name of a rubber stamp.
087: */
088: public static final String NAME_TOP_SECRET = "TopSecret";
089: /**
090: * Constant for the name of a rubber stamp.
091: */
092: public static final String NAME_DEPARTMENTAL = "Departmental";
093: /**
094: * Constant for the name of a rubber stamp.
095: */
096: public static final String NAME_CONFIDENTIAL = "Confidential";
097: /**
098: * Constant for the name of a rubber stamp.
099: */
100: public static final String NAME_FINAL = "Final";
101: /**
102: * Constant for the name of a rubber stamp.
103: */
104: public static final String NAME_SOLD = "Sold";
105:
106: /**
107: * The type of annotation.
108: */
109: public static final String SUB_TYPE = "Stamp";
110:
111: /**
112: * Constructor.
113: */
114: public PDAnnotationRubberStamp() {
115: super ();
116: getDictionary().setItem(COSName.SUBTYPE,
117: COSName.getPDFName(SUB_TYPE));
118: }
119:
120: /**
121: * Creates a Rubber Stamp annotation from a COSDictionary, expected to be
122: * a correct object definition.
123: *
124: * @param field the PDF objet to represent as a field.
125: */
126: public PDAnnotationRubberStamp(COSDictionary field) {
127: super (field);
128: }
129:
130: /**
131: * This will set the name (and hence appearance, AP taking precedence)
132: * For this annotation. See the NAME_XXX constants for valid values.
133: *
134: * @param name The name of the rubber stamp.
135: */
136: public void setName(String name) {
137: getDictionary().setName(COSName.NAME, name);
138: }
139:
140: /**
141: * This will retrieve the name (and hence appearance, AP taking precedence)
142: * For this annotation. The default is DRAFT.
143: *
144: * @return The name of this rubber stamp, see the NAME_XXX constants.
145: */
146: public String getName() {
147: return getDictionary()
148: .getNameAsString(COSName.NAME, NAME_DRAFT);
149: }
150: }
|