1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.pdfbox.pdmodel.interactive.annotation; 18 19 import org.apache.pdfbox.cos.COSDictionary; 20 import org.apache.pdfbox.cos.COSName; 21 22 /** 23 * This is the class that represents a rubber stamp annotation. 24 * Introduced in PDF 1.3 specification 25 * 26 * @author Paul King 27 * @version $Revision: 1.2 $ 28 */ 29 public class PDAnnotationRubberStamp extends PDAnnotationMarkup 30 { 31 32 /* 33 * The various values of the rubber stamp as defined in 34 * the PDF 1.6 reference Table 8.28 35 */ 36 37 /** 38 * Constant for the name of a rubber stamp. 39 */ 40 public static final String NAME_APPROVED = "Approved"; 41 /** 42 * Constant for the name of a rubber stamp. 43 */ 44 public static final String NAME_EXPERIMENTAL = "Experimental"; 45 /** 46 * Constant for the name of a rubber stamp. 47 */ 48 public static final String NAME_NOT_APPROVED = "NotApproved"; 49 /** 50 * Constant for the name of a rubber stamp. 51 */ 52 public static final String NAME_AS_IS = "AsIs"; 53 /** 54 * Constant for the name of a rubber stamp. 55 */ 56 public static final String NAME_EXPIRED = "Expired"; 57 /** 58 * Constant for the name of a rubber stamp. 59 */ 60 public static final String NAME_NOT_FOR_PUBLIC_RELEASE = "NotForPublicRelease"; 61 /** 62 * Constant for the name of a rubber stamp. 63 */ 64 public static final String NAME_FOR_PUBLIC_RELEASE = "ForPublicRelease"; 65 /** 66 * Constant for the name of a rubber stamp. 67 */ 68 public static final String NAME_DRAFT = "Draft"; 69 /** 70 * Constant for the name of a rubber stamp. 71 */ 72 public static final String NAME_FOR_COMMENT = "ForComment"; 73 /** 74 * Constant for the name of a rubber stamp. 75 */ 76 public static final String NAME_TOP_SECRET = "TopSecret"; 77 /** 78 * Constant for the name of a rubber stamp. 79 */ 80 public static final String NAME_DEPARTMENTAL = "Departmental"; 81 /** 82 * Constant for the name of a rubber stamp. 83 */ 84 public static final String NAME_CONFIDENTIAL = "Confidential"; 85 /** 86 * Constant for the name of a rubber stamp. 87 */ 88 public static final String NAME_FINAL = "Final"; 89 /** 90 * Constant for the name of a rubber stamp. 91 */ 92 public static final String NAME_SOLD = "Sold"; 93 94 /** 95 * The type of annotation. 96 */ 97 public static final String SUB_TYPE = "Stamp"; 98 99 /** 100 * Constructor. 101 */ 102 public PDAnnotationRubberStamp() 103 { 104 super(); 105 getDictionary().setItem( COSName.SUBTYPE, COSName.getPDFName( SUB_TYPE ) ); 106 } 107 108 /** 109 * Creates a Rubber Stamp annotation from a COSDictionary, expected to be 110 * a correct object definition. 111 * 112 * @param field the PDF objet to represent as a field. 113 */ 114 public PDAnnotationRubberStamp(COSDictionary field) 115 { 116 super( field ); 117 } 118 119 /** 120 * This will set the name (and hence appearance, AP taking precedence) 121 * For this annotation. See the NAME_XXX constants for valid values. 122 * 123 * @param name The name of the rubber stamp. 124 */ 125 public void setName( String name ) 126 { 127 getDictionary().setName(COSName.NAME, name); 128 } 129 130 /** 131 * This will retrieve the name (and hence appearance, AP taking precedence) 132 * For this annotation. The default is DRAFT. 133 * 134 * @return The name of this rubber stamp, see the NAME_XXX constants. 135 */ 136 public String getName() 137 { 138 return getDictionary().getNameAsString(COSName.NAME, NAME_DRAFT); 139 } 140 }