origamindee 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +89 -0
- data/COPYING.LESSER +165 -0
- data/README.md +131 -0
- data/bin/config/pdfcop.conf.yml +236 -0
- data/bin/pdf2pdfa +87 -0
- data/bin/pdf2ruby +333 -0
- data/bin/pdfcop +476 -0
- data/bin/pdfdecompress +97 -0
- data/bin/pdfdecrypt +91 -0
- data/bin/pdfencrypt +113 -0
- data/bin/pdfexplode +223 -0
- data/bin/pdfextract +277 -0
- data/bin/pdfmetadata +143 -0
- data/bin/pdfsh +12 -0
- data/bin/shell/console.rb +128 -0
- data/bin/shell/hexdump.rb +59 -0
- data/bin/shell/irbrc +69 -0
- data/examples/README.md +34 -0
- data/examples/attachments/attachment.rb +38 -0
- data/examples/attachments/nested_document.rb +51 -0
- data/examples/encryption/encryption.rb +28 -0
- data/examples/events/events.rb +72 -0
- data/examples/flash/flash.rb +37 -0
- data/examples/flash/helloworld.swf +0 -0
- data/examples/forms/javascript.rb +54 -0
- data/examples/forms/xfa.rb +115 -0
- data/examples/javascript/hello_world.rb +22 -0
- data/examples/javascript/js_emulation.rb +54 -0
- data/examples/loop/goto.rb +32 -0
- data/examples/loop/named.rb +33 -0
- data/examples/signature/signature.rb +65 -0
- data/examples/uri/javascript.rb +56 -0
- data/examples/uri/open-uri.rb +21 -0
- data/examples/uri/submitform.rb +47 -0
- data/lib/origami/3d.rb +364 -0
- data/lib/origami/acroform.rb +321 -0
- data/lib/origami/actions.rb +318 -0
- data/lib/origami/annotations.rb +711 -0
- data/lib/origami/array.rb +242 -0
- data/lib/origami/boolean.rb +90 -0
- data/lib/origami/catalog.rb +418 -0
- data/lib/origami/collections.rb +144 -0
- data/lib/origami/compound.rb +161 -0
- data/lib/origami/destinations.rb +252 -0
- data/lib/origami/dictionary.rb +192 -0
- data/lib/origami/encryption.rb +1084 -0
- data/lib/origami/extensions/fdf.rb +347 -0
- data/lib/origami/extensions/ppklite.rb +422 -0
- data/lib/origami/filespec.rb +197 -0
- data/lib/origami/filters/ascii.rb +211 -0
- data/lib/origami/filters/ccitt/tables.rb +267 -0
- data/lib/origami/filters/ccitt.rb +357 -0
- data/lib/origami/filters/crypt.rb +38 -0
- data/lib/origami/filters/dct.rb +54 -0
- data/lib/origami/filters/flate.rb +69 -0
- data/lib/origami/filters/jbig2.rb +57 -0
- data/lib/origami/filters/jpx.rb +47 -0
- data/lib/origami/filters/lzw.rb +170 -0
- data/lib/origami/filters/predictors.rb +292 -0
- data/lib/origami/filters/runlength.rb +129 -0
- data/lib/origami/filters.rb +364 -0
- data/lib/origami/font.rb +196 -0
- data/lib/origami/functions.rb +79 -0
- data/lib/origami/graphics/colors.rb +230 -0
- data/lib/origami/graphics/instruction.rb +98 -0
- data/lib/origami/graphics/path.rb +182 -0
- data/lib/origami/graphics/patterns.rb +174 -0
- data/lib/origami/graphics/render.rb +62 -0
- data/lib/origami/graphics/state.rb +149 -0
- data/lib/origami/graphics/text.rb +225 -0
- data/lib/origami/graphics/xobject.rb +918 -0
- data/lib/origami/graphics.rb +38 -0
- data/lib/origami/header.rb +75 -0
- data/lib/origami/javascript.rb +713 -0
- data/lib/origami/linearization.rb +330 -0
- data/lib/origami/metadata.rb +172 -0
- data/lib/origami/name.rb +135 -0
- data/lib/origami/null.rb +65 -0
- data/lib/origami/numeric.rb +181 -0
- data/lib/origami/obfuscation.rb +245 -0
- data/lib/origami/object.rb +760 -0
- data/lib/origami/optionalcontent.rb +183 -0
- data/lib/origami/outline.rb +54 -0
- data/lib/origami/outputintents.rb +85 -0
- data/lib/origami/page.rb +722 -0
- data/lib/origami/parser.rb +269 -0
- data/lib/origami/parsers/fdf.rb +56 -0
- data/lib/origami/parsers/pdf/lazy.rb +176 -0
- data/lib/origami/parsers/pdf/linear.rb +122 -0
- data/lib/origami/parsers/pdf.rb +118 -0
- data/lib/origami/parsers/ppklite.rb +57 -0
- data/lib/origami/pdf.rb +1108 -0
- data/lib/origami/reference.rb +134 -0
- data/lib/origami/signature.rb +702 -0
- data/lib/origami/stream.rb +705 -0
- data/lib/origami/string.rb +444 -0
- data/lib/origami/template/patterns.rb +56 -0
- data/lib/origami/template/widgets.rb +151 -0
- data/lib/origami/trailer.rb +190 -0
- data/lib/origami/tree.rb +62 -0
- data/lib/origami/version.rb +23 -0
- data/lib/origami/webcapture.rb +100 -0
- data/lib/origami/xfa/config.rb +453 -0
- data/lib/origami/xfa/connectionset.rb +146 -0
- data/lib/origami/xfa/datasets.rb +49 -0
- data/lib/origami/xfa/localeset.rb +42 -0
- data/lib/origami/xfa/package.rb +59 -0
- data/lib/origami/xfa/pdf.rb +73 -0
- data/lib/origami/xfa/signature.rb +42 -0
- data/lib/origami/xfa/sourceset.rb +43 -0
- data/lib/origami/xfa/stylesheet.rb +44 -0
- data/lib/origami/xfa/template.rb +1691 -0
- data/lib/origami/xfa/xdc.rb +42 -0
- data/lib/origami/xfa/xfa.rb +146 -0
- data/lib/origami/xfa/xfdf.rb +43 -0
- data/lib/origami/xfa/xmpmeta.rb +43 -0
- data/lib/origami/xfa.rb +62 -0
- data/lib/origami/xreftable.rb +557 -0
- data/lib/origami.rb +47 -0
- data/test/dataset/calc.pdf +85 -0
- data/test/dataset/crypto.pdf +36 -0
- data/test/dataset/empty.pdf +49 -0
- data/test/test_actions.rb +27 -0
- data/test/test_annotations.rb +68 -0
- data/test/test_forms.rb +30 -0
- data/test/test_native_types.rb +83 -0
- data/test/test_object_tree.rb +33 -0
- data/test/test_pages.rb +60 -0
- data/test/test_pdf.rb +20 -0
- data/test/test_pdf_attachment.rb +34 -0
- data/test/test_pdf_create.rb +24 -0
- data/test/test_pdf_encrypt.rb +102 -0
- data/test/test_pdf_parse.rb +134 -0
- data/test/test_pdf_parse_lazy.rb +69 -0
- data/test/test_pdf_sign.rb +97 -0
- data/test/test_streams.rb +184 -0
- data/test/test_xrefs.rb +67 -0
- metadata +280 -0
@@ -0,0 +1,711 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
This file is part of Origami, PDF manipulation framework for Ruby
|
4
|
+
Copyright (C) 2016 Guillaume Delugré.
|
5
|
+
|
6
|
+
Origami is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU Lesser General Public License as published by
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
Origami is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with Origami. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
=end
|
20
|
+
|
21
|
+
module Origami
|
22
|
+
|
23
|
+
# Forward declaration.
|
24
|
+
class Action < Dictionary; end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Class representing an annotation.
|
28
|
+
# Annotations are objects which user can interact with.
|
29
|
+
#
|
30
|
+
class Annotation < Dictionary
|
31
|
+
include StandardObject
|
32
|
+
|
33
|
+
#
|
34
|
+
# An AppearanceStream is a FormXObject.
|
35
|
+
#
|
36
|
+
class AppearanceStream < Graphics::FormXObject ; end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Appearance Dictionary of an Annotation.
|
40
|
+
#
|
41
|
+
class AppearanceDictionary < Dictionary
|
42
|
+
include StandardObject
|
43
|
+
|
44
|
+
field :N, :Type => [ AppearanceStream, Dictionary ], :Required => true
|
45
|
+
field :R, :Type => [ AppearanceStream, Dictionary ]
|
46
|
+
field :D, :Type => [ AppearanceStream, Dictionary ]
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Class representing additional actions which can be associated with an annotation having an AA field.
|
51
|
+
#
|
52
|
+
class AdditionalActions < Dictionary
|
53
|
+
include StandardObject
|
54
|
+
|
55
|
+
field :E, :Type => Action, :Version => "1.2" # Mouse Enter
|
56
|
+
field :X, :Type => Action, :Version => "1.2" # Mouse Exit
|
57
|
+
field :D, :Type => Action, :Version => "1.2" # Mouse Down
|
58
|
+
field :U, :Type => Action, :Version => "1.2" # Mouse Up
|
59
|
+
field :Fo, :Type => Action, :Version => "1.2" # Focus
|
60
|
+
field :Bl, :Type => Action, :Version => "1.2" # Blur
|
61
|
+
field :PO, :Type => Action, :Version => "1.2" # Page Open
|
62
|
+
field :PC, :Type => Action, :Version => "1.2" # Page Close
|
63
|
+
field :PV, :Type => Action, :Version => "1.2" # Page Visible
|
64
|
+
field :PI, :Type => Action, :Version => "1.2" # Page Invisible
|
65
|
+
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# Annotation fields.
|
69
|
+
#
|
70
|
+
field :Type, :Type => Name, :Default => :Annot
|
71
|
+
field :Subtype, :Type => Name, :Required => true
|
72
|
+
field :Rect, :Type => Rectangle, :Default => [ 0, 0, 0, 0 ], :Required => true
|
73
|
+
field :Contents, :Type => String
|
74
|
+
field :P, :Type => Page, :Version => "1.3"
|
75
|
+
field :NM, :Type => String, :Version => "1.4"
|
76
|
+
field :M, :Type => String, :Version => "1.1"
|
77
|
+
field :F, :Type => Integer, :Default => 0, :Version => "1.1"
|
78
|
+
field :AP, :Type => AppearanceDictionary, :Version => "1.2"
|
79
|
+
field :AS, :Type => Name, :Version => "1.2"
|
80
|
+
field :Border, :Type => Array, :Default => [ 0 , 0 , 1 ]
|
81
|
+
field :C, :Type => Array.of(Number), :Version => "1.1"
|
82
|
+
field :StructParent, :Type => Integer, :Version => "1.3"
|
83
|
+
field :OC, :Type => Dictionary, :Version => "1.5"
|
84
|
+
|
85
|
+
def set_normal_appearance(apstm)
|
86
|
+
self.AP ||= AppearanceDictionary.new
|
87
|
+
self.AP[:N] = apstm
|
88
|
+
|
89
|
+
self
|
90
|
+
end
|
91
|
+
|
92
|
+
def set_rollover_appearance(apstm)
|
93
|
+
self.AP ||= AppearanceDictionary.new
|
94
|
+
self.AP[:R] = apstm
|
95
|
+
|
96
|
+
self
|
97
|
+
end
|
98
|
+
|
99
|
+
def set_down_appearance(apstm)
|
100
|
+
self.AP ||= AppearanceStream.new
|
101
|
+
self.AP[:D] = apstm
|
102
|
+
|
103
|
+
self
|
104
|
+
end
|
105
|
+
|
106
|
+
module Triggerable
|
107
|
+
|
108
|
+
def onMouseOver(action)
|
109
|
+
self.AA ||= AdditionalActions.new
|
110
|
+
self.AA.E = action
|
111
|
+
end
|
112
|
+
|
113
|
+
def onMouseOut(action)
|
114
|
+
self.AA ||= AdditionalActions.new
|
115
|
+
self.AA.X = action
|
116
|
+
end
|
117
|
+
|
118
|
+
def onMouseDown(action)
|
119
|
+
self.AA ||= AdditionalActions.new
|
120
|
+
self.AA.D = action
|
121
|
+
end
|
122
|
+
|
123
|
+
def onMouseUp(action)
|
124
|
+
self.AA ||= AdditionalActions.new
|
125
|
+
self.AA.U = action
|
126
|
+
end
|
127
|
+
|
128
|
+
def onFocus(action)
|
129
|
+
self.AA ||= AdditionalActions.new
|
130
|
+
self.AA.Fo = action
|
131
|
+
end
|
132
|
+
|
133
|
+
def onBlur(action)
|
134
|
+
self.AA ||= AdditionalActions.new
|
135
|
+
self.AA.Bl = action
|
136
|
+
end
|
137
|
+
|
138
|
+
def onPageOpen(action)
|
139
|
+
self.AA ||= AdditionalActions.new
|
140
|
+
self.AA.PO = action
|
141
|
+
end
|
142
|
+
|
143
|
+
def onPageClose(action)
|
144
|
+
self.AA ||= AdditionalActions.new
|
145
|
+
self.AA.PC = action
|
146
|
+
end
|
147
|
+
|
148
|
+
def onPageVisible(action)
|
149
|
+
self.AA ||= AdditionalActions.new
|
150
|
+
self.AA.PV = action
|
151
|
+
end
|
152
|
+
|
153
|
+
def onPageInvisible(action)
|
154
|
+
self.AA ||= AdditionalActions.new
|
155
|
+
self.AA.PI = action
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
#
|
160
|
+
# Annotation flags
|
161
|
+
#
|
162
|
+
module Flags
|
163
|
+
INVISIBLE = 1 << 0
|
164
|
+
HIDDEN = 1 << 1
|
165
|
+
PRINT = 1 << 2
|
166
|
+
NOZOOM = 1 << 3
|
167
|
+
NOROTATE = 1 << 4
|
168
|
+
NOVIEW = 1 << 5
|
169
|
+
READONLY = 1 << 6
|
170
|
+
LOCKED = 1 << 7
|
171
|
+
TOGGLENOVIEW = 1 << 8
|
172
|
+
LOCKEDCONTENTS = 1 << 9
|
173
|
+
end
|
174
|
+
|
175
|
+
module Markup
|
176
|
+
def self.included(receiver)
|
177
|
+
receiver.field :T, :Type => String, :Version => "1.1"
|
178
|
+
receiver.field :Popup, :Type => Dictionary, :Version => "1.3"
|
179
|
+
receiver.field :CA, :Type => Number, :Default => 1.0, :Version => "1.4"
|
180
|
+
receiver.field :RC, :Type => [String, Stream], :Version => "1.5"
|
181
|
+
receiver.field :CreationDate, :Type => String, :Version => "1.5"
|
182
|
+
receiver.field :IRT, :Type => Dictionary, :Version => "1.5"
|
183
|
+
receiver.field :Subj, :Type => String, :Version => "1.5"
|
184
|
+
receiver.field :RT, :Type => Name, :Default => :R, :Version => "1.6"
|
185
|
+
receiver.field :IT, :Type => Name, :Version => "1.6"
|
186
|
+
receiver.field :ExData, :Type => Dictionary, :Version => "1.7"
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
class BorderStyle < Dictionary
|
191
|
+
include StandardObject
|
192
|
+
|
193
|
+
SOLID = :S
|
194
|
+
DASHED = :D
|
195
|
+
BEVELED = :B
|
196
|
+
INSET = :I
|
197
|
+
UNDERLINE = :U
|
198
|
+
|
199
|
+
field :Type, :Type => Name, :Default => :Border
|
200
|
+
field :W, :Type => Number, :Default => 1
|
201
|
+
field :S, :Type => Name, :Default => SOLID
|
202
|
+
field :D, :Type => Array, :Default => [ 3 ]
|
203
|
+
end
|
204
|
+
|
205
|
+
class BorderEffect < Dictionary
|
206
|
+
include StandardObject
|
207
|
+
|
208
|
+
NONE = :S
|
209
|
+
CLOUDY = :C
|
210
|
+
|
211
|
+
field :S, :Type => Name, :Default => NONE
|
212
|
+
field :I, :Type => Integer, :Default => 0
|
213
|
+
end
|
214
|
+
|
215
|
+
class AppearanceCharacteristics < Dictionary
|
216
|
+
include StandardObject
|
217
|
+
|
218
|
+
module CaptionStyle
|
219
|
+
CAPTION_ONLY = 0
|
220
|
+
ICON_ONLY = 1
|
221
|
+
CAPTION_BELOW = 2
|
222
|
+
CAPTION_ABOVE = 3
|
223
|
+
CAPTION_RIGHT = 4
|
224
|
+
CAPTION_LEFT = 5
|
225
|
+
CAPTION_OVERLAID = 6
|
226
|
+
end
|
227
|
+
|
228
|
+
field :R, :Type => Integer, :Default => 0
|
229
|
+
field :BC, :Type => Array.of(Number)
|
230
|
+
field :BG, :Type => Array.of(Number)
|
231
|
+
field :CA, :Type => String
|
232
|
+
field :RC, :Type => String
|
233
|
+
field :AC, :Type => String
|
234
|
+
field :I, :Type => Stream
|
235
|
+
field :RI, :Type => Stream
|
236
|
+
field :IX, :Type => Stream
|
237
|
+
field :IF, :Type => Dictionary
|
238
|
+
field :TP, :Type => Integer, :Default => CaptionStyle::CAPTION_ONLY
|
239
|
+
end
|
240
|
+
|
241
|
+
class Shape < Annotation
|
242
|
+
include Markup
|
243
|
+
|
244
|
+
field :Subtype, :Type => Name, :Required => true
|
245
|
+
field :BS, :Type => BorderStyle
|
246
|
+
field :IC, :Type => Array.of(Number)
|
247
|
+
field :BE, :Type => BorderEffect, :Version => "1.5"
|
248
|
+
field :RD, :Type => Rectangle, :Version => "1.5"
|
249
|
+
end
|
250
|
+
|
251
|
+
class Square < Shape
|
252
|
+
field :Subtype, :Type => Name, :Default => :Square, :Required => true
|
253
|
+
end
|
254
|
+
|
255
|
+
class Circle < Shape
|
256
|
+
field :Subtype, :Type => Name, :Default => :Circle, :Required => true
|
257
|
+
end
|
258
|
+
|
259
|
+
#
|
260
|
+
# Text annotation
|
261
|
+
#
|
262
|
+
class Text < Annotation
|
263
|
+
include Markup
|
264
|
+
|
265
|
+
module TextName
|
266
|
+
COMMENT = :C
|
267
|
+
KEY = :K
|
268
|
+
NOTE = :N
|
269
|
+
HELP = :H
|
270
|
+
NEWPARAGRAPH = :NP
|
271
|
+
PARAGRAPH = :P
|
272
|
+
INSERT = :I
|
273
|
+
end
|
274
|
+
|
275
|
+
field :Subtype, :Type => Name, :Default => :Text, :Required => true
|
276
|
+
field :Open, :Type => Boolean, :Default => false
|
277
|
+
field :Name, :Type => Name, :Default => TextName::NOTE
|
278
|
+
field :State, :Type => String, :Version => "1.5"
|
279
|
+
field :StateModel, :Type => String, :Version => "1.5"
|
280
|
+
|
281
|
+
def pre_build
|
282
|
+
model = self.StateModel
|
283
|
+
state = self.State
|
284
|
+
|
285
|
+
case model
|
286
|
+
when "Marked"
|
287
|
+
self.State = "Unmarked" if state.nil?
|
288
|
+
when "Review"
|
289
|
+
self.State = "None" if state.nil?
|
290
|
+
end
|
291
|
+
|
292
|
+
super
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
#
|
297
|
+
# FreeText Annotation
|
298
|
+
#
|
299
|
+
class FreeText < Annotation
|
300
|
+
include Markup
|
301
|
+
|
302
|
+
module Intent
|
303
|
+
FREETEXT = :FreeText
|
304
|
+
FREETEXTCALLOUT = :FreeTextCallout
|
305
|
+
FREETEXTTYPEWRITER = :FreeTextTypeWriter
|
306
|
+
end
|
307
|
+
|
308
|
+
field :Subtype, :Type => Name, :Default => :FreeText, :Required => true
|
309
|
+
field :DA, :Type => String, :Default => "/F1 10 Tf 0 g", :Required => true
|
310
|
+
field :Q, :Type => Integer, :Default => Field::TextAlign::LEFT, :Version => "1.4"
|
311
|
+
field :RC, :Type => [String, Stream], :Version => "1.5"
|
312
|
+
field :DS, :Type => String, :Version => "1.5"
|
313
|
+
field :CL, :Type => Array.of(Number), :Version => "1.6"
|
314
|
+
field :IT, :Type => Name, :Default => Intent::FREETEXT, :Version => "1.6"
|
315
|
+
field :BE, :Type => BorderEffect, :Version => "1.6"
|
316
|
+
field :RD, :Type => Rectangle, :Version => "1.6"
|
317
|
+
field :BS, :Type => BorderStyle, :Version => "1.6"
|
318
|
+
field :LE, :Type => Name, :Default => :None, :Version => "1.6"
|
319
|
+
end
|
320
|
+
|
321
|
+
#
|
322
|
+
# Class representing an link annotation.
|
323
|
+
#
|
324
|
+
class Link < Annotation
|
325
|
+
|
326
|
+
#
|
327
|
+
# The annotations highlighting mode.
|
328
|
+
# The visual effect to be used when the mouse button is pressed or held down inside its active area.
|
329
|
+
#
|
330
|
+
module Highlight
|
331
|
+
# No highlighting
|
332
|
+
NONE = :N
|
333
|
+
|
334
|
+
# Invert the contents of the annotation rectangle.
|
335
|
+
INVERT = :I
|
336
|
+
|
337
|
+
# Invert the annotations border.
|
338
|
+
OUTLINE = :O
|
339
|
+
|
340
|
+
# Display the annotation as if it were being pushed below the surface of the page
|
341
|
+
PUSH = :P
|
342
|
+
end
|
343
|
+
|
344
|
+
field :Subtype, :Type => Name, :Default => :Link, :Required => true
|
345
|
+
field :A, :Type => Action, :Version => "1.1"
|
346
|
+
field :Dest, :Type => [ Destination, Name, String ]
|
347
|
+
field :H, :Type => Name, :Default => Highlight::INVERT, :Version => "1.2"
|
348
|
+
field :PA, :Type => Dictionary, :Version => "1.3"
|
349
|
+
field :QuadPoints, :Type => Array.of(Number), :Version => "1.6"
|
350
|
+
field :BS, :Type => BorderStyle, :Version => "1.6"
|
351
|
+
end
|
352
|
+
|
353
|
+
#
|
354
|
+
# Class representing a file attachment annotation.
|
355
|
+
#
|
356
|
+
class FileAttachment < Annotation
|
357
|
+
include Markup
|
358
|
+
|
359
|
+
# Icons to be displayed for file attachment.
|
360
|
+
module Icons
|
361
|
+
GRAPH = :Graph
|
362
|
+
PAPERCLIP = :Paperclip
|
363
|
+
PUSHPIN = :PushPin
|
364
|
+
TAG = :Tag
|
365
|
+
end
|
366
|
+
|
367
|
+
field :Subtype, :Type => Name, :Default => :FileAttachment, :Required => true
|
368
|
+
field :FS, :Type => FileSpec, :Required => true
|
369
|
+
field :Name, :Type => Name, :Default => Icons::PUSHPIN
|
370
|
+
end
|
371
|
+
|
372
|
+
#
|
373
|
+
# Class representing a screen Annotation.
|
374
|
+
# A screen annotation specifies a region of a page upon which media clips may be played. It also serves as an object from which actions can be triggered.
|
375
|
+
#
|
376
|
+
class Screen < Annotation
|
377
|
+
include Triggerable
|
378
|
+
|
379
|
+
field :Subtype, :Type => Name, :Default => :Screen, :Required => true
|
380
|
+
field :T, :Type => String
|
381
|
+
field :MK, :Type => AppearanceCharacteristics
|
382
|
+
field :A, :Type => Action, :Version => "1.1"
|
383
|
+
field :AA, :Type => AdditionalActions, :Version => "1.2"
|
384
|
+
end
|
385
|
+
|
386
|
+
class Sound < Annotation
|
387
|
+
include Markup
|
388
|
+
|
389
|
+
module Icons
|
390
|
+
SPEAKER = :Speaker
|
391
|
+
MIC = :Mic
|
392
|
+
end
|
393
|
+
|
394
|
+
field :Subtype, :Type => Name, :Default => :Sound, :Required => true
|
395
|
+
field :Sound, :Type => Stream, :Required => true
|
396
|
+
field :Name, :Type => Name, :Default => Icons::SPEAKER
|
397
|
+
end
|
398
|
+
|
399
|
+
class RichMedia < Annotation
|
400
|
+
|
401
|
+
class Position < Dictionary
|
402
|
+
include StandardObject
|
403
|
+
|
404
|
+
NEAR = :Near
|
405
|
+
CENTER = :Center
|
406
|
+
FAR = :Far
|
407
|
+
|
408
|
+
field :Type, :Type => Name, :Default => :RichMediaPosition, :Version => "1.7", :ExtensionLevel => 3
|
409
|
+
field :HAlign, :Type => Name, :Default => FAR, :Version => "1.7", :ExtensionLevel => 3
|
410
|
+
field :VAlign, :Type => Name, :Default => NEAR, :Version => "1.7", :ExtensionLevel => 3
|
411
|
+
field :HOffset, :Type => Number, :Default => 18, :Version => "1.7", :ExtensionLevel => 3
|
412
|
+
field :VOffset, :Type => Number, :Default => 18, :Version => "1.7", :ExtensionLevel => 3
|
413
|
+
end
|
414
|
+
|
415
|
+
class Window < Dictionary
|
416
|
+
include StandardObject
|
417
|
+
|
418
|
+
field :Type, :Type => Name, :Default => :RichMediaWindow, :Version => "1.7", :ExtensionLevel => 3
|
419
|
+
field :Width, :Type => Dictionary, :Default => {:Default => 288, :Max => 576, :Min => 72}, :Version => "1.7", :ExtensionLevel => 3
|
420
|
+
field :Height, :Type => Dictionary, :Default => {:Default => 216, :Max => 432, :Min => 72}, :Version => "1.7", :ExtensionLevel => 3
|
421
|
+
field :Position, :Type => Position, :Version => "1.7", :ExtensionLevel => 3
|
422
|
+
end
|
423
|
+
|
424
|
+
class Presentation < Dictionary
|
425
|
+
include StandardObject
|
426
|
+
|
427
|
+
WINDOWED = :Windowed
|
428
|
+
EMBEDDED = :Embedded
|
429
|
+
|
430
|
+
field :Type, :Type => Name, :Default => :RichMediaPresentation, :Version => "1.7", :ExtensionLevel => 3
|
431
|
+
field :Style, :Type => Name, :Default => EMBEDDED, :Version => "1.7", :ExtensionLevel => 3
|
432
|
+
field :Window, :Type => Window, :Version => "1.7", :ExtensionLevel => 3
|
433
|
+
field :Transparent, :Type => Boolean, :Default => false, :Version => "1.7", :ExtensionLevel => 3
|
434
|
+
field :NavigationPane, :Type => Boolean, :Default => false, :Version => "1.7", :ExtensionLevel => 3
|
435
|
+
field :Toolbar, :Type => Boolean, :Version => "1.7", :ExtensionLevel => 3
|
436
|
+
field :PassContextClick, :Type => Boolean, :Default => false, :Version => "1.7", :ExtensionLevel => 3
|
437
|
+
end
|
438
|
+
|
439
|
+
class Animation < Dictionary
|
440
|
+
include StandardObject
|
441
|
+
|
442
|
+
NONE = :None
|
443
|
+
LINEAR = :Linear
|
444
|
+
OSCILLATING = :Oscillating
|
445
|
+
|
446
|
+
field :Type, :Type => Name, :Default => :RichMediaAnimation, :Version => "1.7", :ExtensionLevel => 3
|
447
|
+
field :Subtype, :Type => Name, :Default => NONE, :Version => "1.7", :ExtensionLevel => 3
|
448
|
+
field :PlayCount, :Type => Integer, :Default => -1, :Version => "1.7", :ExtensionLevel => 3
|
449
|
+
field :Speed, :Type => Number, :Default => 1, :Version => "1.7", :ExtensionLevel => 3
|
450
|
+
end
|
451
|
+
|
452
|
+
class Activation < Dictionary
|
453
|
+
include StandardObject
|
454
|
+
|
455
|
+
USER_ACTION = :XA
|
456
|
+
PAGE_OPEN = :PO
|
457
|
+
PAGE_VISIBLE = :PV
|
458
|
+
|
459
|
+
field :Type, :Type => Name, :Default => :RichMediaActivation, :Version => "1.7", :ExtensionLevel => 3
|
460
|
+
field :Condition, :Type => Name, :Default => USER_ACTION, :Version => "1.7", :ExtensionLevel => 3
|
461
|
+
field :Animation, :Type => Animation, :Version => "1.7", :ExtensionLevel => 3
|
462
|
+
field :View, :Type => Dictionary, :Version => "1.7", :ExtensionLevel => 3
|
463
|
+
field :Configuration, :Type => Dictionary, :Version => "1.7", :ExtensionLevel => 3
|
464
|
+
field :Presentation, :Type => Presentation, :Version => "1.7", :ExtensionLevel => 3
|
465
|
+
field :Scripts, :Type => Array.of(FileSpec), :Version => "1.7", :ExtensionLevel => 3
|
466
|
+
end
|
467
|
+
|
468
|
+
class Deactivation < Dictionary
|
469
|
+
include StandardObject
|
470
|
+
|
471
|
+
USER_ACTION = :XD
|
472
|
+
PAGE_CLOSE = :PC
|
473
|
+
PAGE_INVISIBLE = :PV
|
474
|
+
|
475
|
+
field :Type, :Type => Name, :Default => :RichMediaDeactivation, :Version => "1.7", :ExtensionLevel => 3
|
476
|
+
field :Condition, :Type => Name, :Default => USER_ACTION, :Version => "1.7", :ExtensionLevel => 3
|
477
|
+
end
|
478
|
+
|
479
|
+
class Settings < Dictionary
|
480
|
+
include StandardObject
|
481
|
+
|
482
|
+
field :Type, :Type => Name, :Default => :RichMediaSettings, :Version => "1.7", :ExtensionLevel => 3
|
483
|
+
field :Activation, :Type => Activation, :Version => "1.7", :ExtensionLevel => 3
|
484
|
+
field :Deactivation, :Type => Deactivation, :Version => "1.7", :ExtensionLevel => 3
|
485
|
+
end
|
486
|
+
|
487
|
+
class CuePoint < Dictionary
|
488
|
+
include StandardObject
|
489
|
+
|
490
|
+
NAVIGATION = :Navigation
|
491
|
+
EVENT = :Event
|
492
|
+
|
493
|
+
field :Type, :Type => Name, :Default => :CuePoint, :Version => "1.7", :ExtensionLevel => 3
|
494
|
+
field :Subtype, :Type => Name, :Version => "1.7", :ExtensionLevel => 3
|
495
|
+
field :Name, :Type => String, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
496
|
+
field :Time, :Type => Number, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
497
|
+
field :A, :Type => Action, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
498
|
+
end
|
499
|
+
|
500
|
+
class Parameters < Dictionary
|
501
|
+
include StandardObject
|
502
|
+
|
503
|
+
module Binding
|
504
|
+
NONE = :None
|
505
|
+
FOREGROUND = :Foreground
|
506
|
+
BACKGROUND = :Background
|
507
|
+
MATERIAL = :Material
|
508
|
+
end
|
509
|
+
|
510
|
+
field :Type, :Type => Name, :Default => :RichMediaParams, :Version => "1.7", :ExtensionLevel => 3
|
511
|
+
field :FlashVars, :Type => [String, Stream], :Version => "1.7", :ExtensionLevel => 3
|
512
|
+
field :Binding, :Type => Name, :Default => Binding::NONE, :Version => "1.7", :ExtensionLevel => 3
|
513
|
+
field :BindingMaterialName, :Type => String, :Version => "1.7", :ExtensionLevel => 3
|
514
|
+
field :CuePoints, :Type => Array.of(CuePoint), :Default => [], :Version => "1.7", :ExtensionLevel => 3
|
515
|
+
field :Settings, :Type => [String, Stream], :Version => "1.7", :ExtensionLevel => 3
|
516
|
+
end
|
517
|
+
|
518
|
+
class Instance < Dictionary
|
519
|
+
include StandardObject
|
520
|
+
|
521
|
+
U3D = :"3D"
|
522
|
+
FLASH = :Flash
|
523
|
+
SOUND = :Sound
|
524
|
+
VIDEO = :Video
|
525
|
+
|
526
|
+
field :Type, :Type => Name, :Default => :RichMediaInstance, :Version => "1.7", :ExtensionLevel => 3
|
527
|
+
field :Subtype, :Type => Name, :Version => "1.7", :ExtensionLevel => 3
|
528
|
+
field :Params, :Type => Parameters, :Version => "1.7", :ExtensionLevel => 3
|
529
|
+
field :Asset, :Type => FileSpec, :Version => "1.7", :ExtensionLevel => 3
|
530
|
+
end
|
531
|
+
|
532
|
+
class Configuration < Dictionary
|
533
|
+
include StandardObject
|
534
|
+
|
535
|
+
U3D = :"3D"
|
536
|
+
FLASH = :Flash
|
537
|
+
SOUND = :Sound
|
538
|
+
VIDEO = :Video
|
539
|
+
|
540
|
+
field :Type, :Type => Name, :Default => :RichMediaConfiguration, :Version => "1.7", :ExtensionLevel => 3
|
541
|
+
field :Subtype, :Type => Name, :Version => "1.7", :ExtensionLevel => 3
|
542
|
+
field :Name, :Type => String, :Version => "1.7", :ExtensionLevel => 3
|
543
|
+
field :Instances, :Type => Array.of(Instance), :Version => "1.7", :ExtensionLevel => 3
|
544
|
+
end
|
545
|
+
|
546
|
+
class Content < Dictionary
|
547
|
+
include StandardObject
|
548
|
+
|
549
|
+
field :Type, :Type => Name, :Default => :RichMediaContent, :Version => "1.7", :ExtensionLevel => 3
|
550
|
+
field :Assets, :Type => Dictionary, :Version => "1.7", :ExtensionLevel => 3
|
551
|
+
field :Configurations, :Type => Array.of(Configuration), :Version => "1.7", :ExtensionLevel => 3
|
552
|
+
field :Views, :Type => Array, :Version => "1.7", :ExtensionLevel => 3
|
553
|
+
end
|
554
|
+
|
555
|
+
#
|
556
|
+
# Fields of the RichMedia Annotation.
|
557
|
+
#
|
558
|
+
field :Subtype, :Type => Name, :Default => :RichMedia, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
559
|
+
field :RichMediaSettings, :Type => Settings, :Version => "1.7", :ExtensionLevel => 3
|
560
|
+
field :RichMediaContent, :Type => Content, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
561
|
+
end
|
562
|
+
|
563
|
+
# Added in ExtensionLevel 3.
|
564
|
+
class Projection < Annotation; end
|
565
|
+
|
566
|
+
#
|
567
|
+
# Class representing a widget Annotation.
|
568
|
+
# Interactive forms use widget annotations to represent the appearance of fields and to manage user interactions.
|
569
|
+
#
|
570
|
+
class Widget < Annotation
|
571
|
+
include Field
|
572
|
+
include Triggerable
|
573
|
+
|
574
|
+
module Highlight
|
575
|
+
# No highlighting
|
576
|
+
NONE = :N
|
577
|
+
|
578
|
+
# Invert the contents of the annotation rectangle.
|
579
|
+
INVERT = :I
|
580
|
+
|
581
|
+
# Invert the annotations border.
|
582
|
+
OUTLINE = :O
|
583
|
+
|
584
|
+
# Display the annotation as if it were being pushed below the surface of the page
|
585
|
+
PUSH = :P
|
586
|
+
|
587
|
+
# Same as P.
|
588
|
+
TOGGLE = :T
|
589
|
+
end
|
590
|
+
|
591
|
+
field :Subtype, :Type => Name, :Default => :Widget, :Required => true
|
592
|
+
field :H, :Type => Name, :Default => Highlight::INVERT
|
593
|
+
field :MK, :Type => AppearanceCharacteristics
|
594
|
+
field :A, :Type => Action, :Version => "1.1"
|
595
|
+
field :AA, :Type => AdditionalActions, :Version => "1.2"
|
596
|
+
field :BS, :Type => BorderStyle, :Version => "1.2"
|
597
|
+
|
598
|
+
def onActivate(action)
|
599
|
+
unless action.is_a?(Action)
|
600
|
+
raise TypeError, "An Action object must be passed."
|
601
|
+
end
|
602
|
+
|
603
|
+
self.A = action
|
604
|
+
end
|
605
|
+
|
606
|
+
class Button < Widget
|
607
|
+
|
608
|
+
module Flags
|
609
|
+
NOTOGGLETOOFF = 1 << 14
|
610
|
+
RADIO = 1 << 15
|
611
|
+
PUSHBUTTON = 1 << 16
|
612
|
+
RADIOSINUNISON = 1 << 26
|
613
|
+
end
|
614
|
+
|
615
|
+
field :FT, :Type => Name, :Default => Field::Type::BUTTON, :Required => true
|
616
|
+
end
|
617
|
+
|
618
|
+
class PushButton < Button
|
619
|
+
|
620
|
+
def pre_build
|
621
|
+
self.Ff ||= 0
|
622
|
+
self.Ff |= Button::Flags::PUSHBUTTON
|
623
|
+
|
624
|
+
super
|
625
|
+
end
|
626
|
+
end
|
627
|
+
|
628
|
+
class CheckBox < Button
|
629
|
+
|
630
|
+
def pre_build
|
631
|
+
self.Ff ||= 0
|
632
|
+
|
633
|
+
self.Ff &= ~Button::Flags::RADIO
|
634
|
+
self.Ff &= ~Button::Flags::PUSHBUTTON
|
635
|
+
|
636
|
+
super
|
637
|
+
end
|
638
|
+
end
|
639
|
+
|
640
|
+
class Radio < Button
|
641
|
+
|
642
|
+
def pre_build
|
643
|
+
self.Ff ||= 0
|
644
|
+
|
645
|
+
self.Ff &= ~Button::Flags::PUSHBUTTON
|
646
|
+
self.Ff |= Button::Flags::RADIO
|
647
|
+
|
648
|
+
super
|
649
|
+
end
|
650
|
+
end
|
651
|
+
|
652
|
+
class Text < Widget
|
653
|
+
module Flags
|
654
|
+
MULTILINE = 1 << 12
|
655
|
+
PASSWORD = 1 << 13
|
656
|
+
FILESELECT = 1 << 20
|
657
|
+
DONOTSPELLCHECK = 1 << 22
|
658
|
+
DONOTSCROLL = 1 << 23
|
659
|
+
COMB = 1 << 24
|
660
|
+
RICHTEXT = 1 << 25
|
661
|
+
end
|
662
|
+
|
663
|
+
field :FT, :Type => Name, :Default => Field::Type::TEXT, :Required => true
|
664
|
+
field :MaxLen, :Type => Integer
|
665
|
+
end
|
666
|
+
|
667
|
+
class Choice < Widget
|
668
|
+
module Flags
|
669
|
+
COMBO = 1 << 17
|
670
|
+
EDIT = 1 << 18
|
671
|
+
SORT = 1 << 19
|
672
|
+
MULTISELECT = 1 << 21
|
673
|
+
DONOTSPELLCHECK = 1 << 22
|
674
|
+
COMMITONSELCHANGE = 1 << 26
|
675
|
+
end
|
676
|
+
|
677
|
+
field :FT, :Type => Name, :Default => Field::Type::CHOICE, :Required => true
|
678
|
+
field :Opt, :Type => Array
|
679
|
+
field :TI, :Type => Integer, :Default => 0
|
680
|
+
field :I, :Type => Array, :Version => "1.4"
|
681
|
+
end
|
682
|
+
|
683
|
+
class ComboBox < Choice
|
684
|
+
|
685
|
+
def pre_build
|
686
|
+
self.Ff ||= 0
|
687
|
+
self.Ff |= Choice::Flags::COMBO
|
688
|
+
|
689
|
+
super
|
690
|
+
end
|
691
|
+
end
|
692
|
+
|
693
|
+
class ListBox < Choice
|
694
|
+
|
695
|
+
def pre_build
|
696
|
+
self.Ff ||= 0
|
697
|
+
self.Ff &= ~Choice::Flags::COMBO
|
698
|
+
|
699
|
+
super
|
700
|
+
end
|
701
|
+
end
|
702
|
+
|
703
|
+
class Signature < Widget
|
704
|
+
field :FT, :Type => Name, :Default => Field::Type::SIGNATURE
|
705
|
+
field :Lock, :Type => SignatureLock, :Version => "1.5"
|
706
|
+
field :SV, :Type => SignatureSeedValue, :Version => "1.5"
|
707
|
+
end
|
708
|
+
end
|
709
|
+
end
|
710
|
+
|
711
|
+
end
|