KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pdfbox > pdmodel > documentinterchange > logicalstructure > PDMarkInfo


1 /**
2  * Copyright (c) 2005, www.pdfbox.org
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * 3. Neither the name of pdfbox; nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * http://www.pdfbox.org
29  *
30  */

31 package org.pdfbox.pdmodel.documentinterchange.logicalstructure;
32
33 import org.pdfbox.cos.COSBase;
34 import org.pdfbox.cos.COSDictionary;
35 import org.pdfbox.pdmodel.common.COSObjectable;
36
37 /**
38  * The MarkInfo provides additional information relevant to specialized
39  * uses of structured documents.
40  *
41  * @author <a HREF="mailto:ben@benlitchfield.com">Ben Litchfield</a>
42  * @version $Revision: 1.4 $
43  */

44 public class PDMarkInfo implements COSObjectable
45 {
46     private COSDictionary dictionary;
47     
48     /**
49      * Default Constructor.
50      *
51      */

52     public PDMarkInfo()
53     {
54         dictionary = new COSDictionary();
55     }
56     
57     /**
58      * Constructor for an existing MarkInfo element.
59      *
60      * @param dic The existing dictionary.
61      */

62     public PDMarkInfo( COSDictionary dic )
63     {
64         dictionary = dic;
65     }
66     
67     /**
68      * Convert this standard java object to a COS object.
69      *
70      * @return The cos object that matches this Java object.
71      */

72     public COSBase getCOSObject()
73     {
74         return dictionary;
75     }
76     
77     /**
78      * Convert this standard java object to a COS object.
79      *
80      * @return The cos object that matches this Java object.
81      */

82     public COSDictionary getDictionary()
83     {
84         return dictionary;
85     }
86     
87     /**
88      * Tells if this is a tagged PDF.
89      *
90      * @return true If this is a tagged PDF.
91      */

92     public boolean isMarked()
93     {
94         return dictionary.getBoolean( "Marked", false );
95     }
96     
97     /**
98      * Set if this is a tagged PDF.
99      *
100      * @param value The new marked value.
101      */

102     public void setMarked( boolean value )
103     {
104         dictionary.setBoolean( "Marked", value );
105     }
106     
107     /**
108      * Tells if structure elements use user properties.
109      *
110      * @return A boolean telling if the structure elements use user properties.
111      */

112     public boolean usesUserProperties()
113     {
114         return dictionary.getBoolean( "UserProperties", false );
115     }
116     
117     /**
118      * Set if the structure elements contain user properties.
119      *
120      * @param userProps The new value for this property.
121      */

122     public void setUserProperties( boolean userProps )
123     {
124         dictionary.setBoolean( "UserProperties", userProps );
125     }
126     
127     /**
128      * Tells if this PDF contain 'suspect' tags. See PDF Reference 1.6
129      * section 10.6 "Logical Structure" for more information about this property.
130      *
131      * @return true if the suspect flag has been set.
132      */

133     public boolean isSuspect()
134     {
135         return dictionary.getBoolean( "Suspects", false );
136     }
137     
138     /**
139      * Set the value of the suspects property. See PDF Reference 1.6
140      * section 10.6 "Logical Structure" for more information about this
141      * property.
142      *
143      * @param suspect The new "Suspects" value.
144      */

145     public void setSuspect( boolean suspect )
146     {
147         dictionary.setBoolean( "Suspects", false );
148     }
149 }
150
Popular Tags