001: /*
002: * Copyright (c) 2007, intarsys consulting GmbH
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * - Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * - 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: *
014: * - Neither the name of intarsys nor the names of its contributors may be used
015: * to endorse or promote products derived from this software without specific
016: * prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
021: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
022: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
024: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
025: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
026: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
027: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
028: * POSSIBILITY OF SUCH DAMAGE.
029: */
030: package de.intarsys.pdf.cos;
031:
032: import de.intarsys.pdf.cds.CDSDate;
033:
034: /**
035: * The document information dictionary..
036: */
037: public class COSInfoDict extends COSBasedObject {
038: /**
039: * The meta class implementation
040: */
041: public static class MetaClass extends COSBasedObject.MetaClass {
042: protected MetaClass(Class instanceClass) {
043: super (instanceClass);
044: }
045: }
046:
047: /** Well known attributes */
048: public static final COSName DK_CreationDate = COSName
049: .constant("CreationDate"); //$NON-NLS-1$
050:
051: public static final COSName DK_Creator = COSName
052: .constant("Creator"); //$NON-NLS-1$
053:
054: public static final COSName DK_ModDate = COSName
055: .constant("ModDate"); //$NON-NLS-1$
056:
057: public static final COSName DK_Producer = COSName
058: .constant("Producer"); //$NON-NLS-1$
059:
060: public static final COSName DK_Title = COSName.constant("Title"); //$NON-NLS-1$
061:
062: public static final COSName DK_Author = COSName.constant("Author"); //$NON-NLS-1$
063:
064: public static final COSName DK_Subject = COSName
065: .constant("Subject"); //$NON-NLS-1$
066:
067: public static final COSName DK_Keywords = COSName
068: .constant("Keywords"); //$NON-NLS-1$
069:
070: public static final COSName DK_Trapped = COSName
071: .constant("Trapped"); //$NON-NLS-1$
072:
073: /** The meta class instance */
074: public static final MetaClass META = new MetaClass(MetaClass.class
075: .getDeclaringClass());
076:
077: protected COSInfoDict(COSObject object) {
078: super (object);
079: }
080:
081: /**
082: * The /Author field in the info dictionary.
083: *
084: */
085: public String getAuthor() {
086: return getFieldString(DK_Author, null);
087: }
088:
089: /**
090: * The /CreationDate field in the info dictionary.
091: *
092: */
093: public CDSDate getCreationDate() {
094: return getFieldDate(DK_CreationDate, null);
095: }
096:
097: /**
098: * The /CreationDate field in the info dictionary as a {@link String}.
099: *
100: */
101: public String getCreationDateString() {
102: return getFieldString(DK_CreationDate, null);
103: }
104:
105: /**
106: * The /Creator field in the info dictionary.
107: *
108: */
109: public String getCreator() {
110: return getFieldString(DK_Creator, null);
111: }
112:
113: /**
114: * The /Keywords field in the info dictionary.
115: *
116: */
117: public String getKeywords() {
118: return getFieldString(DK_Keywords, null);
119: }
120:
121: /**
122: * The /ModDate field in the info dictionary.
123: *
124: */
125: public CDSDate getModDate() {
126: return getFieldDate(DK_ModDate, null);
127: }
128:
129: /**
130: * The /ModDate field in the info dictionary as a {@link String}.
131: *
132: */
133: public String getModDateString() {
134: return getFieldString(DK_ModDate, null);
135: }
136:
137: /**
138: * The /Producer field in the info dictionary.
139: *
140: */
141: public String getProducer() {
142: return getFieldString(DK_Producer, null);
143: }
144:
145: /**
146: * The /Subject field in the info dictionary.
147: *
148: */
149: public String getSubject() {
150: return getFieldString(DK_Subject, null);
151: }
152:
153: /**
154: * The /Title field in the info dictionary.
155: *
156: */
157: public String getTitle() {
158: return getFieldString(DK_Title, null);
159: }
160:
161: /**
162: * The /Trapped field in the info dictionary.
163: *
164: */
165: public String getTrapped() {
166: return getFieldString(DK_Trapped, null);
167: }
168:
169: /*
170: * (non-Javadoc)
171: *
172: * @see de.intarsys.pdf.cos.COSBasedObject#initializeFromScratch()
173: */
174: protected void initializeFromScratch() {
175: super .initializeFromScratch();
176: cosSetField(DK_Creator, COSString
177: .create("jPod intarsys consulting pdf library") //$NON-NLS-1$
178: );
179: cosSetField(DK_CreationDate, new CDSDate().cosGetObject());
180: cosSetField(DK_Producer, COSString
181: .create("jPod intarsys consulting pdf library") //$NON-NLS-1$
182: );
183: cosSetField(DK_ModDate, new CDSDate().cosGetObject());
184: }
185:
186: /**
187: * Set the /Author field in the info dictionary.
188: *
189: */
190: public void setAuthor(String value) {
191: setFieldString(DK_Author, value);
192: }
193:
194: /**
195: * Set the /CreationDate field in the info dictionary.
196: *
197: */
198: public void setCreationDate(String value) {
199: setFieldString(DK_CreationDate, value);
200: }
201:
202: /**
203: * Set the /Creator field in the info dictionary.
204: *
205: */
206: public void setCreator(String value) {
207: setFieldString(DK_Creator, value);
208: }
209:
210: /**
211: * Set the /Keywords field in the info dictionary.
212: *
213: */
214: public void setKeywords(String value) {
215: setFieldString(DK_Keywords, value);
216: }
217:
218: /**
219: * Set the /ModDate field in the info dictionary.
220: *
221: */
222: public void setModDate(String value) {
223: setFieldString(DK_ModDate, value);
224: }
225:
226: /**
227: * Set the /Producer field in the info dictionary.
228: *
229: */
230: public void setProducer(String value) {
231: setFieldString(DK_Producer, value);
232: }
233:
234: /**
235: * Set the /Subject field in the info dictionary.
236: *
237: */
238: public void setSubject(String value) {
239: setFieldString(DK_Subject, value);
240: }
241:
242: /**
243: * Set the /Title field in the info dictionary.
244: *
245: */
246: public void setTitle(String value) {
247: setFieldString(DK_Title, value);
248: }
249:
250: /**
251: * Set the /Trapped field in the info dictionary.
252: *
253: */
254: public void setTrapped(String value) {
255: setFieldName(DK_Author, value);
256: }
257: }
|