PDFLegalAttestation.java
15.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.cos.CosDictionary
* com.adobe.internal.pdftoolkit.core.cos.CosObject
* com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException
* com.adobe.internal.pdftoolkit.core.types.ASName
*/
package com.adobe.internal.pdftoolkit.pdf.digsig;
import com.adobe.internal.pdftoolkit.core.cos.CosDictionary;
import com.adobe.internal.pdftoolkit.core.cos.CosObject;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException;
import com.adobe.internal.pdftoolkit.core.types.ASName;
import com.adobe.internal.pdftoolkit.pdf.document.PDFCosDictionary;
import com.adobe.internal.pdftoolkit.pdf.document.PDFCosObject;
import com.adobe.internal.pdftoolkit.pdf.document.PDFDocument;
public class PDFLegalAttestation
extends PDFCosDictionary {
public static final ASName k_JavaScriptActions = ASName.create((String)"JavaScriptActions");
public static final ASName k_LaunchActions = ASName.create((String)"LaunchActions");
public static final ASName k_URIActions = ASName.create((String)"URIActions");
public static final ASName k_MovieActions = ASName.create((String)"MovieActions");
public static final ASName k_SoundActions = ASName.create((String)"SoundActions");
public static final ASName k_HideAnnotationActions = ASName.create((String)"HideAnnotationActions");
public static final ASName k_RenditionActions = ASName.create((String)"RenditionActions");
public static final ASName k_GoToRemoteActions = ASName.create((String)"GoToRemoteActions");
public static final ASName k_AlternateImages = ASName.create((String)"AlternateImages");
public static final ASName k_ExternalStreams = ASName.create((String)"ExternalStreams");
public static final ASName k_TrueTypeFonts = ASName.create((String)"TrueTypeFonts");
public static final ASName k_ExternalRefXobjects = ASName.create((String)"ExternalRefXobjects");
public static final ASName k_ExternalOPIdicts = ASName.create((String)"ExternalOPIdicts");
public static final ASName k_NonEmbeddedFonts = ASName.create((String)"NonEmbeddedFonts");
public static final ASName k_DevDepGS_OP = ASName.create((String)"DevDepGS_OP");
public static final ASName k_DevDepGS_HT = ASName.create((String)"DevDepGS_HT");
public static final ASName k_DevDepGS_TR = ASName.create((String)"DevDepGS_TR");
public static final ASName k_DevDepGS_UCR = ASName.create((String)"DevDepGS_UCR");
public static final ASName k_DevDepGS_BG = ASName.create((String)"DevDepGS_BG");
public static final ASName k_DevDepGS_FL = ASName.create((String)"DevDepGS_FL");
public static final ASName k_Annotations = ASName.create((String)"Annotations");
public static final ASName k_OptionalContent = ASName.create((String)"OptionalContent");
public static final ASName k_Attestation = ASName.create((String)"Attestation");
private PDFLegalAttestation(CosObject cosObject) throws PDFInvalidDocumentException {
super(cosObject);
}
public static PDFLegalAttestation getInstance(CosObject cosObject) throws PDFInvalidDocumentException {
if (PDFCosObject.checkNullCosObject(cosObject) == null) {
return null;
}
PDFLegalAttestation pdfObject = PDFCosObject.getCachedInstance(cosObject, PDFLegalAttestation.class);
if (pdfObject == null) {
pdfObject = new PDFLegalAttestation(cosObject);
}
return pdfObject;
}
public static PDFLegalAttestation newInstance(PDFDocument pdfDocument) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
CosDictionary cosObject = PDFCosObject.newCosDictionary(pdfDocument);
PDFLegalAttestation pdfObject = new PDFLegalAttestation((CosObject)cosObject);
return pdfObject;
}
private int getLegalAttestationCounter(ASName key) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (this.dictionaryContains(key)) {
return this.getDictionaryIntValue(key);
}
return 0;
}
public int getJavaScriptActionCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_JavaScriptActions);
}
public void setJavaScriptActionCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_JavaScriptActions);
} else {
this.setDictionaryIntValue(k_JavaScriptActions, count);
}
}
public int getLaunchActionsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_LaunchActions);
}
public void setLaunchActionsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_LaunchActions);
} else {
this.setDictionaryIntValue(k_LaunchActions, count);
}
}
public int getURIActionsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_URIActions);
}
public void setURIActionsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_URIActions);
} else {
this.setDictionaryIntValue(k_URIActions, count);
}
}
public int getMovieActionsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_MovieActions);
}
public void setMovieActionsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_MovieActions);
} else {
this.setDictionaryIntValue(k_MovieActions, count);
}
}
public int getSoundActionsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_SoundActions);
}
public void setSoundActionsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_SoundActions);
} else {
this.setDictionaryIntValue(k_SoundActions, count);
}
}
public int getHideAnnotationActionsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_HideAnnotationActions);
}
public void setHideAnnotationActionsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_HideAnnotationActions);
} else {
this.setDictionaryIntValue(k_HideAnnotationActions, count);
}
}
public int getRenditionActionsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_RenditionActions);
}
public void setRenditionActionsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_RenditionActions);
} else {
this.setDictionaryIntValue(k_RenditionActions, count);
}
}
public int getGoToRemoteCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_GoToRemoteActions);
}
public void setGoToRemoteCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_GoToRemoteActions);
} else {
this.setDictionaryIntValue(k_GoToRemoteActions, count);
}
}
public int getAlternateImagesCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_AlternateImages);
}
public void setAlternateImagesCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_AlternateImages);
} else {
this.setDictionaryIntValue(k_AlternateImages, count);
}
}
public int getExternalStreamsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_ExternalStreams);
}
public void setExternalStreamsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_ExternalStreams);
} else {
this.setDictionaryIntValue(k_ExternalStreams, count);
}
}
public int getTrueTypeFontsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_TrueTypeFonts);
}
public void setTrueTypeFontsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_TrueTypeFonts);
} else {
this.setDictionaryIntValue(k_TrueTypeFonts, count);
}
}
public int getExternalRefXobjectsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_ExternalRefXobjects);
}
public void setExternalRefXobjectsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_ExternalRefXobjects);
} else {
this.setDictionaryIntValue(k_ExternalRefXobjects, count);
}
}
public int getExternalOPIdictsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_ExternalOPIdicts);
}
public void setExternalOPIdictsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_ExternalOPIdicts);
} else {
this.setDictionaryIntValue(k_ExternalOPIdicts, count);
}
}
public int getNonEmbeddedFontsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_NonEmbeddedFonts);
}
public void setNonEmbeddedFontsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_NonEmbeddedFonts);
} else {
this.setDictionaryIntValue(k_NonEmbeddedFonts, count);
}
}
public int getDevDepGS_OPCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_DevDepGS_OP);
}
public void setDevDepGS_OPCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_DevDepGS_OP);
} else {
this.setDictionaryIntValue(k_DevDepGS_OP, count);
}
}
public int getDevDepGS_HTCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_DevDepGS_HT);
}
public void setDevDepGS_HTCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_DevDepGS_HT);
} else {
this.setDictionaryIntValue(k_DevDepGS_HT, count);
}
}
public int getDevDepGS_TRCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_DevDepGS_TR);
}
public void setDevDepGS_TRCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_DevDepGS_TR);
} else {
this.setDictionaryIntValue(k_DevDepGS_TR, count);
}
}
public int getDevDepGS_UCRCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_DevDepGS_UCR);
}
public void setDevDepGS_UCRCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_DevDepGS_UCR);
} else {
this.setDictionaryIntValue(k_DevDepGS_UCR, count);
}
}
public int getDevDepGS_BGCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_DevDepGS_BG);
}
public void setDevDepGS_BGCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_DevDepGS_BG);
} else {
this.setDictionaryIntValue(k_DevDepGS_BG, count);
}
}
public int getDevDepGS_FLCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_DevDepGS_FL);
}
public void setDevDepGS_FLCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_DevDepGS_FL);
} else {
this.setDictionaryIntValue(k_DevDepGS_FL, count);
}
}
public int getAnnotationsCount() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
return this.getLegalAttestationCounter(k_Annotations);
}
public void setAnnotationsCount(int count) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (count == 0) {
this.removeValue(k_Annotations);
} else {
this.setDictionaryIntValue(k_Annotations, count);
}
}
public boolean getOptionalContentFound() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (this.dictionaryContains(k_OptionalContent)) {
CosObject value = this.getDictionaryValue(k_OptionalContent);
if (value.getType() == 2) {
return value.booleanValue();
}
return true;
}
return false;
}
public void setOptionalContentFound(boolean ocFoundInDoc) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (!ocFoundInDoc) {
this.removeValue(k_OptionalContent);
} else {
this.setDictionaryBooleanValue(k_OptionalContent, ocFoundInDoc);
}
}
public String getAttestation() throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (this.dictionaryContains(k_Attestation)) {
return this.getDictionaryTextStringValue(k_Attestation);
}
return null;
}
public void setAttestation(String attestation) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
this.setDictionaryStringValue(k_Attestation, attestation);
}
}