blob: 3805a2224b19644e243941d1f828b3fabfc37ffd [file] [log] [blame]
edisonn@google.com1a191c62013-06-11 21:44:08 +00001import sys
2
3class PdfName:
4 def __init__(self, name, abr=''):
5 self.fName = name
6 self.fAbr = abr
edisonn@google.comaf3daa02013-06-12 19:07:45 +00007
8 def toCpp(self):
9 return '\"' + self.fName + '\"'
10
11class PdfString:
12 def __init__(self, value):
13 self.fValue = value
14
15 def toCpp(self):
16 return '\"' + self.fValue + '\"'
edisonn@google.com1a191c62013-06-11 21:44:08 +000017
18class PdfInteger:
19 def __init__(self, value):
20 self.fValue = value
21
edisonn@google.comaf3daa02013-06-12 19:07:45 +000022 def toCpp(self):
23 return str(self.fValue)
24
edisonn@google.com1a191c62013-06-11 21:44:08 +000025class PdfReal:
26 def __init__(self, value):
27 self.fValue = value
28
edisonn@google.comaf3daa02013-06-12 19:07:45 +000029 def toCpp(self):
30 return str(self.fValue)
31
edisonn@google.com1a191c62013-06-11 21:44:08 +000032class PdfString:
33 def __init__(self, value):
34 self.fValue = value
35
edisonn@google.comaf3daa02013-06-12 19:07:45 +000036 def toCpp(self):
37 return self.fValue
38
edisonn@google.com1a191c62013-06-11 21:44:08 +000039class PdfBoolean:
40 def __init__(self, value):
41 self.fValue = value
42
edisonn@google.comaf3daa02013-06-12 19:07:45 +000043 def toCpp(self):
44 return self.fValue
45
edisonn@google.com45327112013-06-13 20:02:29 +000046class CppNull:
47 def toCpp(self):
48 return 'NULL'
49
50
edisonn@google.com1a191c62013-06-11 21:44:08 +000051class PdfField:
52 def __init__(self, parent, name, abr):
53 self.fParent = parent
54 self.fName = name
55 self.fAbr = abr
56
57 self.fDefault = ''
58 self.fType = ''
edisonn@google.comaf3daa02013-06-12 19:07:45 +000059 self.fCppName = ''
60 self.fCppType = ''
61 self.fCppReader = ''
62 self.fValidOptions = []
63 self.fHasMust = False
64 self.fMustBe = ''
edisonn@google.com1a191c62013-06-11 21:44:08 +000065
66 def must(self, value):
edisonn@google.comaf3daa02013-06-12 19:07:45 +000067 self.fHasMust = True
68 self.fMustBe = value
69 return self
edisonn@google.com1a191c62013-06-11 21:44:08 +000070
71 def default(self, value):
72 self.fDefault = value
73 return self
74
edisonn@google.comaf3daa02013-06-12 19:07:45 +000075 def number(self, name):
edisonn@google.com1a191c62013-06-11 21:44:08 +000076 self.fType = 'number'
edisonn@google.comaf3daa02013-06-12 19:07:45 +000077 self.fCppName = name
78 self.fCppType = 'double'
79 self.fCppReader = 'DoubleFromDictionary'
edisonn@google.com1a191c62013-06-11 21:44:08 +000080 return self
81
edisonn@google.comaf3daa02013-06-12 19:07:45 +000082 def integer(self, name):
edisonn@google.com1a191c62013-06-11 21:44:08 +000083 self.fType = 'integer'
edisonn@google.comaf3daa02013-06-12 19:07:45 +000084 self.fCppName = name
85 self.fCppType = 'long'
86 self.fCppReader = 'LongFromDictionary'
edisonn@google.com1a191c62013-06-11 21:44:08 +000087 return self
88
edisonn@google.comaf3daa02013-06-12 19:07:45 +000089 def real(self, name):
edisonn@google.com1a191c62013-06-11 21:44:08 +000090 self.fType = 'real'
edisonn@google.comaf3daa02013-06-12 19:07:45 +000091 self.fCppName = name
92 self.fCppType = 'double'
93 self.fCppReader = 'DoubleFromDictionary'
edisonn@google.com1a191c62013-06-11 21:44:08 +000094 return self
95
edisonn@google.comaf3daa02013-06-12 19:07:45 +000096 def name(self, name):
edisonn@google.com1a191c62013-06-11 21:44:08 +000097 self.fType = 'name'
edisonn@google.comaf3daa02013-06-12 19:07:45 +000098 self.fCppName = name
99 self.fCppType = 'std::string'
100 self.fCppReader = 'NameFromDictionary'
edisonn@google.com1a191c62013-06-11 21:44:08 +0000101 return self
102
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000103 def string(self, name):
edisonn@google.com1a191c62013-06-11 21:44:08 +0000104 self.fType = 'string'
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000105 self.fCppName = name
106 self.fCppType = 'std::string'
107 self.fCppReader = 'StringFromDictionary'
edisonn@google.com1a191c62013-06-11 21:44:08 +0000108 return self
109
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000110 def multiple(self, validOptions):
111 self.fValidOptions = validOptions
edisonn@google.com1a191c62013-06-11 21:44:08 +0000112 return self
113
edisonn@google.com45327112013-06-13 20:02:29 +0000114 def dictionary(self, name):
115 self.fType = 'dictionary'
116 self.fCppName = name
117 self.fDictionaryType = 'Resources' # TODO(edisonn): Dictionary?
118 self.fCppReader = 'DictionaryFromDictionary'
119 self.fDefault = CppNull()
120 return self
121
122 def type(self, type):
123 # TODO (edisonn): if simple type, use it, otherwise set it to Dictionary, and set a mask for valid types, like array or name
124 self.fType = 'dictionary'
125 self.fDictionaryType = 'Dictionary'
126 self.fCppReader = 'DictionaryFromDictionary'
127 self.fDefault = CppNull()
128 return self
129
130 def comment(self, comment):
131 return self
132
edisonn@google.com1a191c62013-06-11 21:44:08 +0000133 def done(self):
134 return self.fParent
135
136
137class PdfClassField:
edisonn@google.com45327112013-06-13 20:02:29 +0000138 def __init__(self, parent, required, version='', inheritable=False, comment=''):
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000139 #self.fProp = ''
edisonn@google.com1a191c62013-06-11 21:44:08 +0000140 self.fParent = parent
141 self.fRequired = required
edisonn@google.com45327112013-06-13 20:02:29 +0000142 self.fVersion = version
143 self.fInheritable = inheritable
144 self.fComment = comment
edisonn@google.com1a191c62013-06-11 21:44:08 +0000145
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000146 def field(self, name, abr=''):
147 self.fProp = PdfField(self, name, abr)
148 return self.fProp
edisonn@google.com1a191c62013-06-11 21:44:08 +0000149
150 def done(self):
151 return self.fParent
152
153class PdfClass:
edisonn@google.com45327112013-06-13 20:02:29 +0000154 def __init__(self, name, base, comment):
edisonn@google.com1a191c62013-06-11 21:44:08 +0000155 self.fFields = []
156 self.fIncludes = []
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000157 self.fCCPublic = []
158 self.fCCPrivate = []
edisonn@google.com1a191c62013-06-11 21:44:08 +0000159 self.fName = name
160 self.fBase = base
edisonn@google.com45327112013-06-13 20:02:29 +0000161 self.fComment = comment
edisonn@google.com1a191c62013-06-11 21:44:08 +0000162
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000163 self.fEnumSubclasses = []
164
165 self.fEnum = '!UNDEFINED'
166 self.fEnumEnd = '!UNDEFINED'
167
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000168 def required(self, badDefault):
edisonn@google.com1a191c62013-06-11 21:44:08 +0000169 field = PdfClassField(self, True)
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000170 field.fBadDefault = badDefault
edisonn@google.com1a191c62013-06-11 21:44:08 +0000171 self.fFields.append(field)
172 return field
173
174 def optional(self):
175 field = PdfClassField(self, False)
176 self.fFields.append(field)
177 return field
edisonn@google.com45327112013-06-13 20:02:29 +0000178
179 #([Required] [;] [inheritable] [;] [version]; [comments])
180 # version: PDF [d].[d]
181 # ; separate props
182 #inheritable
183 #version
184 #required, if
185 #optional, if
edisonn@google.com1a191c62013-06-11 21:44:08 +0000186
187 def include(self, path):
188 self.fIncludes.append(path)
189 return self
190
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000191 def carbonCopyPublic(self, cc):
192 self.fCCPublic.append(cc)
193 return self
194
195 def carbonCopyPrivate(self, cc):
196 self.fCCPrivate.append(cc)
edisonn@google.com1a191c62013-06-11 21:44:08 +0000197 return self
edisonn@google.com45327112013-06-13 20:02:29 +0000198
199 def done(self):
200 return
edisonn@google.com1a191c62013-06-11 21:44:08 +0000201
202class PdfClassManager:
203 def __init__(self):
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000204 self.fClasses = {}
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000205 self.fClassesNamesInOrder = []
edisonn@google.com1a191c62013-06-11 21:44:08 +0000206
edisonn@google.com45327112013-06-13 20:02:29 +0000207 def addClass(self, name, base='Object', comment=''):
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000208 if name == 'Object':
edisonn@google.com45327112013-06-13 20:02:29 +0000209 cls = PdfClass(name, '', comment)
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000210 else:
edisonn@google.com45327112013-06-13 20:02:29 +0000211 cls = PdfClass(name, base, comment)
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000212 self.fClasses[name] = cls
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000213 self.fClassesNamesInOrder.append(name)
edisonn@google.com1a191c62013-06-11 21:44:08 +0000214 return cls
215
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000216 def longName(self, name):
217 ret = ''
218 while name != '':
219 cls = self.fClasses[name]
220 ret = name + ret
221 name = cls.fBase
222
223 return ret
224
225
226 def writeEnum(self, enum, enumToCls):
227 print(' ' + enum + ',')
228 cls = enumToCls[enum]
229 cls.fEnumSubclasses.sort()
230
231 cnt = 0
232 for sub in cls.fEnumSubclasses:
233 self.writeEnum(cls.fEnumSubclasses[cnt], enumToCls)
234 cnt = cnt + 1
235
236 if cnt != 0:
237 print(' ' + cls.fEnumEnd + ',')
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000238
239
240 def writeAsNull(self, cls, enumToCls):
241 print(' virtual SkPdf' + cls.fName +'* as' + cls.fName + '() {return NULL;}')
242 print(' virtual const SkPdf' + cls.fName +'* as' + cls.fName + '() const {return NULL;}')
243 print
244
245 cnt = 0
246 for sub in cls.fEnumSubclasses:
247 self.writeAsNull(enumToCls[cls.fEnumSubclasses[cnt]], enumToCls)
248 cnt = cnt + 1
249
250
251 def writeAsFoo(self, cls, enumToCls):
252 # TODO(edisonn): add a container, with sections, public, private, default, ...
253 # the end code will be grouped
254
255 # me
256 print('public:')
257 print(' virtual SkPdf' + cls.fName +'* as' + cls.fName + '() {return this;}')
258 print(' virtual const SkPdf' + cls.fName +'* as' + cls.fName + '() const {return this;}')
259 print
260
261 if cls.fName == 'Object':
262 cnt = 0
263 for sub in cls.fEnumSubclasses:
264 self.writeAsNull(enumToCls[cls.fEnumSubclasses[cnt]], enumToCls)
265 cnt = cnt + 1
266
267 if cls.fName != 'Object':
268 print('private:')
269 base = self.fClasses[cls.fBase]
270 cnt = 0
271 for sub in base.fEnumSubclasses:
272 if enumToCls[base.fEnumSubclasses[cnt]].fName != cls.fName:
273 self.writeAsNull(enumToCls[base.fEnumSubclasses[cnt]], enumToCls)
274 cnt = cnt + 1
275
276
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000277
edisonn@google.com1a191c62013-06-11 21:44:08 +0000278 def write(self):
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000279 # generate enum
280 enumsRoot = []
281
282 enumToCls = {}
283
284 for name in self.fClasses:
285 cls = self.fClasses[name]
286 enum = self.longName(name)
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000287 cls.fEnum = 'k' + enum + '_SkPdfObjectType'
288 cls.fEnumEnd = 'k' + enum + '__End_SkPdfObjectType'
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000289
290 if cls.fBase != '':
291 self.fClasses[cls.fBase].fEnumSubclasses.append(cls.fEnum)
292
293 if cls.fBase == '':
294 enumsRoot.append(cls.fEnum)
295
296 enumToCls[cls.fEnum] = cls
297
298 enumsRoot.sort()
299
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000300
301 # TODO(edisonn): move each .h in it's own file
302 # write imports
303
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000304 # write enums
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000305 print('enum SkPdfObjectType {')
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000306 for enum in enumsRoot:
307 self.writeEnum(enum, enumToCls)
308 print('};')
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000309 print
310
311 # write forward class declaration
312 for name in self.fClassesNamesInOrder:
313 print('class SkPdf' + name + ';')
314 print
315
316 for name in self.fClassesNamesInOrder:
317 cls = self.fClasses[name]
318 enum = cls.fEnum
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000319
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000320 if cls.fBase == '':
321 print('class SkPdf' + cls.fName + ' {')
322 else:
323 print('class SkPdf' + cls.fName + ' : public SkPdf' + cls.fBase + ' {')
324
325 print('public:')
326 print(' virtual SkPdfObjectType getType() const { return ' + cls.fEnum + ';}')
327 if len(cls.fEnumSubclasses) == 0:
328 print(' virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(' + cls.fEnum + ' + 1);}')
329 else:
330 print(' virtual SkPdfObjectType getTypeEnd() const { return ' + cls.fEnumEnd + ';}')
331
332
333 self.writeAsFoo(cls, enumToCls)
334
335 print('public:')
336 for cc in cls.fCCPublic:
337 print(' ' + cc)
338
339 print('private:')
340 for cc in cls.fCCPrivate:
341 print(' ' + cc)
342
343 if cls.fBase == '':
344 print('protected:')
345 print(' const PdfMemDocument* fPodofoDoc;')
346 print(' const PdfObject* fPodofoObj;')
347 print
348 print('public:')
349 print(' SkPdf' + cls.fName + '(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : fPodofoDoc(podofoDoc), fPodofoObj(podofoObj) {}')
350 print(' const PdfObject* podofo() const { return fPodofoObj;}')
351 else:
352 print('public:')
edisonn@google.com45327112013-06-13 20:02:29 +0000353 print(' SkPdf' + cls.fName + '(const PdfMemDocument* podofoDoc, const PdfObject* podofoObj) : SkPdf' + cls.fBase + '(podofoDoc, podofoObj) {}')
354 print
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000355
356 #check required fieds, also, there should be an internal_valid() manually wrote for complex
357 # situations
358 # right now valid return true
359 print(' virtual bool valid() const {return true;}')
edisonn@google.com45327112013-06-13 20:02:29 +0000360 print
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000361
362 for field in cls.fFields:
363 prop = field.fProp
364 if prop.fCppName != '':
edisonn@google.com45327112013-06-13 20:02:29 +0000365 if prop.fType != 'dictionary':
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000366 print(' ' + prop.fCppType + ' ' + prop.fCppName + '() const {')
367 print(' ' + prop.fCppType + ' ret;')
368 print(' if (' + prop.fCppReader + '(fPodofoDoc, fPodofoObj->GetDictionary(), \"' + prop.fName + '\", \"' + prop.fAbr + '\", &ret)) return ret;')
369 if field.fRequired == False:
370 print(' return ' + prop.fDefault.toCpp() + ';');
371 if field.fRequired == True:
372 print(' // TODO(edisonn): warn about missing required field, assert for known good pdfs')
373 print(' return ' + field.fBadDefault + ';');
374 print(' }')
375 print
edisonn@google.com45327112013-06-13 20:02:29 +0000376
377 if prop.fType == 'dictionary':
378 print(' SkPdf' + prop.fDictionaryType + '* ' + prop.fCppName + '() const {')
379 print(' SkPdfObject* dict = NULL;')
380 print(' if (' + prop.fCppReader + '(fPodofoDoc, fPodofoObj->GetDictionary(), \"' + prop.fName + '\", \"' + prop.fAbr + '\", &dict) && dict != NULL) {')
381 print(' SkPdf' + prop.fDictionaryType + '* ret = new SkPdf' + prop.fDictionaryType + '(fPodofoDoc, dict->podofo());')
382 print(' delete dict; dict = NULL;')
383 print(' return ret;')
384 print(' }')
385 if field.fRequired == False:
386 print(' return ' + prop.fDefault.toCpp() + ';');
387 if field.fRequired == True:
388 print(' // TODO(edisonn): warn about missing required field, assert for known good pdfs')
389 print(' return ' + field.fBadDefault + ';');
390 print(' }')
391 print
392
393
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000394
395 print('};')
396 print
397 print
398
399
400
401 # generate constructor when knowing the type
402 # later, p2, generate constructor when not knowing the type - very similar with parsing?
403
edisonn@google.comf7dd4912013-06-11 23:06:16 +0000404 # generate parser
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000405
406 # TODO(edisonn): fast recognition based on must attributes.
407 print('class PodofoMapper {')
408 print('public:')
409 for name in self.fClassesNamesInOrder:
410 cls = self.fClasses[name]
411
412 print(' static bool map' + name + '(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj, SkPdfObject** out) {')
413 print(' if (!isA' + name + '(podofoDoc, podofoObj)) return false;')
414 print
415
416 for sub in cls.fEnumSubclasses:
417 print(' if (map' + enumToCls[sub].fName + '(podofoDoc, podofoObj, out)) return true;')
418
419 print
420
421 print(' *out = new SkPdf' + name + '(&podofoDoc, &podofoObj);')
422 print(' return true;')
423 print(' }')
424 print
425
426 for name in self.fClassesNamesInOrder:
427 cls = self.fClasses[name]
428
429 print(' static bool isA' + name + '(const PdfMemDocument& podofoDoc, const PdfObject& podofoObj) {')
430
431 cntMust = 0
432 for field in cls.fFields:
433 prop = field.fProp
434 if prop.fHasMust:
435 cntMust = cntMust + 1
436 print(' ' + prop.fCppType + ' ' + prop.fCppName + ';')
437 print(' if (!' + prop.fCppReader + '(&podofoDoc, podofoObj.GetDictionary(), \"' + prop.fName + '\", \"' + prop.fAbr + '\", &' + prop.fCppName + ')) return false;')
438 print(' if (' + prop.fCppName + ' != ' + prop.fMustBe.toCpp() + ') return false;')
439 print
440
441 # hack, we only care about dictionaries now, so ret tru only if there is a match
442 if cntMust != 0 or name == 'Object' or name == 'Dictionary':
443 print(' return true;')
444 else:
445 print(' return false;')
446
447 print(' }')
448 print
449
450 print('};')
451 print
452
edisonn@google.com1a191c62013-06-11 21:44:08 +0000453 return
454
455def generateCode():
456 all = PdfClassManager()
457
458 all.addClass('Object')
459 all.addClass('Null')
460 all.addClass('Boolean')
461 all.addClass('Integer')
462 all.addClass('Real')
463 all.addClass('Name')
464 all.addClass('Stream')
465 all.addClass('Reference')
466 all.addClass('Array')
edisonn@google.com45327112013-06-13 20:02:29 +0000467 all.addClass('Dictionary').optional().field('Resources', '').dictionary("r") #.inherited_from_page_tree()
468
469 all.addClass('Resources', 'Dictionary')
edisonn@google.com1a191c62013-06-11 21:44:08 +0000470
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000471 all.addClass('XObject', 'Dictionary').required('""').field('Type').must(PdfName('XObject')).name('t')
edisonn@google.com1a191c62013-06-11 21:44:08 +0000472
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000473 all.addClass('Image', 'XObject').required('""').field('Type').must(PdfName('XObject')).name('t').done()\
474 .done()\
475 .required('""').field('Subtype').must(PdfName('Image')).name('s').done()\
476 .done()\
477 .required('-1').field('Width', 'W').integer('w').done()\
478 .done()\
479 .required('-1').field('Height', 'H').integer('h').done()\
480 .done()\
481 .required('""').field('ColorSpace').name('cs').multiple([PdfName('/DeviceRGB', '/RGB'), PdfName('/DeviceGray', '/Gray')]).done()\
482 .done()\
483 .optional().field('BitsPerComponent', 'BPC').integer('bpc').multiple([PdfInteger(1), PdfInteger(2), PdfInteger(4), PdfInteger(8)])\
484 .default(PdfInteger(1)).done()\
edisonn@google.com1a191c62013-06-11 21:44:08 +0000485 .done()\
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000486 .carbonCopyPrivate('SkBitmap bitmap;')
edisonn@google.com1a191c62013-06-11 21:44:08 +0000487
edisonn@google.comaf3daa02013-06-12 19:07:45 +0000488 all.addClass('Form', 'XObject').required('""').field('Type').must(PdfName('XObject')).name('t').done()\
489 .done()\
490 .required('""').field('Subtype').must(PdfName('Form')).name('s').done()\
491 .done()\
492 .carbonCopyPublic('void test() {}')
edisonn@google.com1a191c62013-06-11 21:44:08 +0000493
494
edisonn@google.com45327112013-06-13 20:02:29 +0000495
496 all.addClass('SpecificToATrapNetworkAppearanceStream', 'Dictionary', 'Additional entries specific to a trap network appearance stream')\
497 .required('NULL')\
498 .field('PCM')\
499 .name('PCM')\
500 .type('name')\
501 .comment('(Required) The name of the process color model that was assumed when this trap network was created; equivalent to the PostScript page device parameter ProcessColorModel (see Section 6.2.5 of the PostScript Language Reference, Third Edition). Valid values are DeviceGray, DeviceRGB, DeviceCMYK, DeviceCMY, DeviceRGBK, and DeviceN.')\
502 .done().done()\
503 .optional()\
504 .field('SeparationColorNames')\
505 .name('SeparationColorNames')\
506 .type('array')\
507 .comment('(Optional) An array of names identifying the colorants that were assumed when this network was created; equivalent to the Post- Script page device parameter of the same name (see Section 6.2.5 of the PostScript Language Reference, Third Edition). Colorants im- plied by the process color model PCM are available automatically and need not be explicitly declared. If this entry is absent, the colorants implied by PCM are assumed.')\
508 .done().done()\
509 .optional()\
510 .field('TrapRegions')\
511 .name('TrapRegions')\
512 .type('array')\
513 .comment('(Optional) An array of indirect references to TrapRegion objects defining the page\'s trapping zones and the associated trapping parameters, as described in Adobe Technical Note #5620, Portable Job Ticket Format. These references are to objects comprising portions of a PJTF job ticket that is embedded in the PDF file. When the trapping zones and parameters are defined by an external job ticket (or by some other means, such as with JDF), this entry is absent.')\
514 .done().done()\
515 .optional()\
516 .field('TrapStyles')\
517 .name('TrapStyles')\
518 .type('text string')\
519 .comment('(Optional) A human-readable text string that applications can use to describe this trap network to the user (for example, to allow switching between trap networks).')\
520 .done().done()\
521 .done()
522
523 all.addClass('OpiVersionDictionary', 'Dictionary', 'Entry in an OPI version dictionary')\
524 .required('NULL')\
525 .field('version_number')\
526 .name('version_number')\
527 .type('dictionary')\
528 .comment('(Required; PDF 1.2) An OPI dictionary specifying the attributes of this proxy (see Tables 9.50 and 9.51). The key for this entry must be the name 1.3 or 2.0, identifying the version of OPI to which the proxy corresponds.')\
529 .done().done()\
530 .done()
531
532
533
edisonn@google.com1a191c62013-06-11 21:44:08 +0000534 all.write()
535
536 return 1
537
538if '__main__' == __name__:
539 sys.exit(generateCode())
edisonn@google.com45327112013-06-13 20:02:29 +0000540
541