origami 1.2.7 → 2.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.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +66 -0
  3. data/README.md +112 -0
  4. data/bin/config/pdfcop.conf.yml +232 -233
  5. data/bin/gui/about.rb +27 -37
  6. data/bin/gui/config.rb +108 -117
  7. data/bin/gui/file.rb +416 -365
  8. data/bin/gui/gtkhex.rb +1138 -1153
  9. data/bin/gui/hexview.rb +55 -57
  10. data/bin/gui/imgview.rb +48 -51
  11. data/bin/gui/menu.rb +388 -386
  12. data/bin/gui/properties.rb +114 -130
  13. data/bin/gui/signing.rb +571 -617
  14. data/bin/gui/textview.rb +77 -95
  15. data/bin/gui/treeview.rb +382 -387
  16. data/bin/gui/walker.rb +227 -232
  17. data/bin/gui/xrefs.rb +56 -60
  18. data/bin/pdf2pdfa +53 -57
  19. data/bin/pdf2ruby +212 -228
  20. data/bin/pdfcop +338 -348
  21. data/bin/pdfdecompress +58 -65
  22. data/bin/pdfdecrypt +56 -60
  23. data/bin/pdfencrypt +75 -80
  24. data/bin/pdfexplode +185 -182
  25. data/bin/pdfextract +201 -218
  26. data/bin/pdfmetadata +83 -82
  27. data/bin/pdfsh +4 -5
  28. data/bin/pdfwalker +1 -2
  29. data/bin/shell/.irbrc +45 -82
  30. data/bin/shell/console.rb +105 -130
  31. data/bin/shell/hexdump.rb +40 -64
  32. data/examples/README.md +34 -0
  33. data/examples/attachments/attachment.rb +38 -0
  34. data/examples/attachments/nested_document.rb +51 -0
  35. data/examples/encryption/encryption.rb +28 -0
  36. data/{samples/actions/triggerevents/trigger.rb → examples/events/events.rb} +13 -16
  37. data/examples/flash/flash.rb +37 -0
  38. data/{samples → examples}/flash/helloworld.swf +0 -0
  39. data/examples/forms/javascript.rb +54 -0
  40. data/examples/forms/xfa.rb +115 -0
  41. data/examples/javascript/hello_world.rb +22 -0
  42. data/examples/javascript/js_emulation.rb +54 -0
  43. data/examples/loop/goto.rb +32 -0
  44. data/examples/loop/named.rb +33 -0
  45. data/examples/signature/signature.rb +65 -0
  46. data/examples/uri/javascript.rb +56 -0
  47. data/examples/uri/open-uri.rb +21 -0
  48. data/examples/uri/submitform.rb +47 -0
  49. data/lib/origami.rb +29 -42
  50. data/lib/origami/3d.rb +350 -225
  51. data/lib/origami/acroform.rb +262 -288
  52. data/lib/origami/actions.rb +268 -288
  53. data/lib/origami/annotations.rb +697 -722
  54. data/lib/origami/array.rb +258 -184
  55. data/lib/origami/boolean.rb +74 -84
  56. data/lib/origami/catalog.rb +397 -434
  57. data/lib/origami/collections.rb +144 -0
  58. data/lib/origami/destinations.rb +233 -194
  59. data/lib/origami/dictionary.rb +253 -232
  60. data/lib/origami/encryption.rb +1274 -1243
  61. data/lib/origami/export.rb +232 -268
  62. data/lib/origami/extensions/fdf.rb +307 -220
  63. data/lib/origami/extensions/ppklite.rb +368 -435
  64. data/lib/origami/filespec.rb +197 -0
  65. data/lib/origami/filters.rb +301 -295
  66. data/lib/origami/filters/ascii.rb +177 -180
  67. data/lib/origami/filters/ccitt.rb +528 -535
  68. data/lib/origami/filters/crypt.rb +26 -35
  69. data/lib/origami/filters/dct.rb +46 -52
  70. data/lib/origami/filters/flate.rb +95 -94
  71. data/lib/origami/filters/jbig2.rb +49 -55
  72. data/lib/origami/filters/jpx.rb +38 -44
  73. data/lib/origami/filters/lzw.rb +189 -183
  74. data/lib/origami/filters/predictors.rb +221 -235
  75. data/lib/origami/filters/runlength.rb +103 -104
  76. data/lib/origami/font.rb +173 -186
  77. data/lib/origami/functions.rb +67 -81
  78. data/lib/origami/graphics.rb +25 -21
  79. data/lib/origami/graphics/colors.rb +178 -187
  80. data/lib/origami/graphics/instruction.rb +79 -85
  81. data/lib/origami/graphics/path.rb +142 -148
  82. data/lib/origami/graphics/patterns.rb +160 -167
  83. data/lib/origami/graphics/render.rb +43 -50
  84. data/lib/origami/graphics/state.rb +138 -153
  85. data/lib/origami/graphics/text.rb +188 -205
  86. data/lib/origami/graphics/xobject.rb +819 -815
  87. data/lib/origami/header.rb +63 -78
  88. data/lib/origami/javascript.rb +596 -597
  89. data/lib/origami/linearization.rb +285 -290
  90. data/lib/origami/metadata.rb +139 -148
  91. data/lib/origami/name.rb +112 -148
  92. data/lib/origami/null.rb +53 -62
  93. data/lib/origami/numeric.rb +162 -175
  94. data/lib/origami/obfuscation.rb +186 -174
  95. data/lib/origami/object.rb +593 -573
  96. data/lib/origami/outline.rb +42 -47
  97. data/lib/origami/outputintents.rb +73 -82
  98. data/lib/origami/page.rb +703 -592
  99. data/lib/origami/parser.rb +238 -290
  100. data/lib/origami/parsers/fdf.rb +41 -33
  101. data/lib/origami/parsers/pdf.rb +75 -95
  102. data/lib/origami/parsers/pdf/lazy.rb +137 -0
  103. data/lib/origami/parsers/pdf/linear.rb +64 -66
  104. data/lib/origami/parsers/ppklite.rb +34 -70
  105. data/lib/origami/pdf.rb +1030 -1005
  106. data/lib/origami/reference.rb +102 -102
  107. data/lib/origami/signature.rb +591 -609
  108. data/lib/origami/stream.rb +668 -551
  109. data/lib/origami/string.rb +397 -373
  110. data/lib/origami/template/patterns.rb +56 -0
  111. data/lib/origami/template/widgets.rb +151 -0
  112. data/lib/origami/trailer.rb +144 -158
  113. data/lib/origami/tree.rb +62 -0
  114. data/lib/origami/version.rb +23 -0
  115. data/lib/origami/webcapture.rb +88 -79
  116. data/lib/origami/xfa.rb +2863 -2882
  117. data/lib/origami/xreftable.rb +472 -384
  118. data/test/dataset/calc.pdf +85 -0
  119. data/test/dataset/crypto.pdf +82 -0
  120. data/test/dataset/empty.pdf +49 -0
  121. data/test/test_actions.rb +27 -0
  122. data/test/test_annotations.rb +90 -0
  123. data/test/test_pages.rb +31 -0
  124. data/test/test_pdf.rb +16 -0
  125. data/test/test_pdf_attachment.rb +34 -0
  126. data/test/test_pdf_create.rb +24 -0
  127. data/test/test_pdf_encrypt.rb +95 -0
  128. data/test/test_pdf_parse.rb +96 -0
  129. data/test/test_pdf_sign.rb +58 -0
  130. data/test/test_streams.rb +182 -0
  131. data/test/test_xrefs.rb +67 -0
  132. metadata +88 -58
  133. data/README +0 -67
  134. data/bin/pdf2graph +0 -121
  135. data/bin/pdfcocoon +0 -104
  136. data/lib/origami/file.rb +0 -233
  137. data/samples/README.txt +0 -45
  138. data/samples/actions/launch/calc.rb +0 -87
  139. data/samples/actions/launch/winparams.rb +0 -22
  140. data/samples/actions/loop/loopgoto.rb +0 -24
  141. data/samples/actions/loop/loopnamed.rb +0 -21
  142. data/samples/actions/named/named.rb +0 -31
  143. data/samples/actions/samba/smbrelay.rb +0 -26
  144. data/samples/actions/webbug/submitform.js +0 -26
  145. data/samples/actions/webbug/webbug-browser.rb +0 -68
  146. data/samples/actions/webbug/webbug-js.rb +0 -67
  147. data/samples/actions/webbug/webbug-reader.rb +0 -90
  148. data/samples/attachments/attach.rb +0 -40
  149. data/samples/attachments/attached.txt +0 -1
  150. data/samples/crypto/crypto.rb +0 -28
  151. data/samples/digsig/signed.rb +0 -46
  152. data/samples/exploits/cve-2008-2992-utilprintf.rb +0 -87
  153. data/samples/exploits/cve-2009-0927-geticon.rb +0 -65
  154. data/samples/exploits/exploit_customdictopen.rb +0 -55
  155. data/samples/exploits/getannots.rb +0 -69
  156. data/samples/flash/flash.rb +0 -31
  157. data/samples/javascript/attached.txt +0 -1
  158. data/samples/javascript/js.rb +0 -52
  159. data/templates/patterns.rb +0 -66
  160. data/templates/widgets.rb +0 -173
  161. data/templates/xdp.rb +0 -92
  162. data/test/ts_pdf.rb +0 -50
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'origami'
5
+ rescue LoadError
6
+ $: << File.join(__dir__, "/../../lib")
7
+ require 'origami'
8
+ end
9
+ include Origami
10
+
11
+ #
12
+ # Displays a message box when the document is opened.
13
+ #
14
+
15
+ OUTPUT_FILE = "#{File.basename(__FILE__, ".rb")}.pdf"
16
+
17
+ # Creating a new file
18
+ pdf = PDF.new
19
+ .onDocumentOpen(Action::JavaScript 'app.alert("Hello world");')
20
+ .save(OUTPUT_FILE)
21
+
22
+ puts "PDF file saved as #{OUTPUT_FILE}."
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'origami'
5
+ rescue LoadError
6
+ $: << File.join(__dir__, "/../../lib")
7
+ require 'origami'
8
+ end
9
+ include Origami
10
+
11
+ #
12
+ # Emulating JavaScript inside a PDF object.
13
+ #
14
+
15
+ if defined?(PDF::JavaScript::Engine)
16
+
17
+ # Creating a new file
18
+ pdf = PDF.new
19
+
20
+ # Embedding the file into the PDF.
21
+ pdf.attach_file(DATA,
22
+ name: "README.txt",
23
+ filter: :ASCIIHexDecode
24
+ )
25
+
26
+ # Example of JS payload
27
+ pdf.onDocumentOpen Action::JavaScript <<-JS
28
+ if ( app.viewerVersion == 8 )
29
+ eval("this.exportDataObject({cName:'README.txt', nLaunch:2});");
30
+ this.closeDoc();
31
+ JS
32
+
33
+ # Tweaking the engine options
34
+ pdf.js_engine.options[:log_method_calls] = true
35
+ pdf.js_engine.options[:viewerVersion] = 10
36
+
37
+ # Hooking eval()
38
+ pdf.js_engine.hook 'eval' do |eval, expr|
39
+ puts "Hook: eval(#{expr.inspect})"
40
+ eval.call(expr) # calling the real eval method
41
+ end
42
+
43
+ # Example of inline JS evaluation
44
+ pdf.eval_js 'console.println(util.stringFromStream(this.getDataObjectContents("README.txt")))'
45
+
46
+ # Executes the string as a JS script
47
+ pdf.Catalog.OpenAction[:JS].eval_js
48
+
49
+ else
50
+ abort "JavaScript support not found. You need to install therubyracer gem."
51
+ end
52
+
53
+ __END__
54
+ ** THIS IS THE EMBEDDED FILE **
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'origami'
5
+ rescue LoadError
6
+ $: << File.join(__dir__, "../../lib")
7
+ require 'origami'
8
+ end
9
+ include Origami
10
+
11
+ OUTPUT_FILE = "#{File.basename(__FILE__, '.rb')}.pdf"
12
+
13
+ pdf = PDF.new
14
+
15
+ 50.times do |n|
16
+ pdf.append_page do |page|
17
+ contents = ContentStream.new
18
+ contents.write "page #{n+1}",
19
+ x: 250, y: 450, rendering: Text::Rendering::FILL, size: 30
20
+
21
+ page.Contents = contents
22
+ end
23
+ end
24
+
25
+ pages = pdf.pages
26
+ pages.each_with_index do |page, index|
27
+ page.onOpen Action::GoTo Destination::GlobalFit[pages[(index + 1) % pages.size]]
28
+ end
29
+
30
+ pdf.save(OUTPUT_FILE)
31
+
32
+ puts "PDF file saved as #{OUTPUT_FILE}."
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'origami'
5
+ rescue LoadError
6
+ $: << File.join(__dir__, "../../lib")
7
+ require 'origami'
8
+ end
9
+ include Origami
10
+
11
+ OUTPUT_FILE = "#{File.basename(__FILE__, '.rb')}.pdf"
12
+
13
+ pdf = PDF.new
14
+
15
+ 50.times do |n|
16
+ pdf.append_page do |page|
17
+ contents = ContentStream.new
18
+ contents.write "page #{n+1}",
19
+ x: 250, y: 450, rendering: Text::Rendering::FILL, size: 30
20
+
21
+ page.Contents = contents
22
+
23
+ if n != 49
24
+ page.onOpen Action::Named::NEXT_PAGE
25
+ else
26
+ page.onOpen Action::Named::FIRST_PAGE
27
+ end
28
+ end
29
+ end
30
+
31
+ pdf.save(OUTPUT_FILE)
32
+
33
+ puts "PDF file saved as #{OUTPUT_FILE}."
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'openssl'
4
+
5
+ begin
6
+ require 'origami'
7
+ rescue LoadError
8
+ $: << File.join(__dir__, "../../lib")
9
+ require 'origami'
10
+ end
11
+ include Origami
12
+
13
+ OUTPUT_FILE = "#{File.basename(__FILE__, ".rb")}.pdf"
14
+
15
+ puts "Generating a RSA key pair."
16
+ key = OpenSSL::PKey::RSA.new 2048
17
+
18
+ puts "Generating a self-signed certificate."
19
+ name = OpenSSL::X509::Name.parse 'CN=origami/DC=example'
20
+
21
+ cert = OpenSSL::X509::Certificate.new
22
+ cert.version = 2
23
+ cert.serial = 0
24
+ cert.not_before = Time.now
25
+ cert.not_after = Time.now + 3600
26
+
27
+ cert.public_key = key.public_key
28
+ cert.subject = name
29
+
30
+ extension_factory = OpenSSL::X509::ExtensionFactory.new nil, cert
31
+
32
+ cert.add_extension extension_factory.create_extension('basicConstraints', 'CA:TRUE', true)
33
+ cert.add_extension extension_factory.create_extension('keyUsage', 'digitalSignature')
34
+ cert.add_extension extension_factory.create_extension('subjectKeyIdentifier', 'hash')
35
+
36
+ cert.issuer = name
37
+ cert.sign key, OpenSSL::Digest::SHA256.new
38
+
39
+ # Create the PDF contents
40
+ contents = ContentStream.new.setFilter(:FlateDecode)
41
+ contents.write OUTPUT_FILE,
42
+ x: 350, y: 750, rendering: Text::Rendering::STROKE, size: 30
43
+
44
+ pdf = PDF.new
45
+ page = Page.new.setContents(contents)
46
+ pdf.append_page(page)
47
+
48
+ sig_annot = Annotation::Widget::Signature.new
49
+ sig_annot.Rect = Rectangle[llx: 89.0, lly: 386.0, urx: 190.0, ury: 353.0]
50
+
51
+ page.add_annotation(sig_annot)
52
+
53
+ # Sign the PDF with the specified keys
54
+ pdf.sign(cert, key,
55
+ method: 'adbe.pkcs7.detached',
56
+ annotation: sig_annot,
57
+ location: "France",
58
+ contact: "gdelugre@localhost",
59
+ reason: "Signature sample"
60
+ )
61
+
62
+ # Save the resulting file
63
+ pdf.save(OUTPUT_FILE)
64
+
65
+ puts "PDF file saved as #{OUTPUT_FILE}."
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/ruby
2
+
3
+ begin
4
+ require 'origami'
5
+ rescue LoadError
6
+ $: << File.join(__dir__, "../../lib")
7
+ require 'origami'
8
+ end
9
+ include Origami
10
+
11
+ OUTPUT_FILE = "#{File.basename(__FILE__, '.rb')}.pdf"
12
+ URL = "http://google.fr"
13
+
14
+ contents = ContentStream.new.setFilter(:FlateDecode)
15
+ contents.write OUTPUT_FILE,
16
+ :x => 200, :y => 750, :rendering => Text::Rendering::FILL, :size => 30
17
+
18
+ contents.write "The script first tries to run your browser using JavaScript.",
19
+ :x => 100, :y => 670, :size => 15
20
+
21
+ # A JS script to execute at the opening of the document
22
+ jscript = <<JS
23
+ try {
24
+ app.launchURL("#{URL}");
25
+ }
26
+ catch(e) {}
27
+
28
+ try {
29
+ this.submitForm(
30
+ {
31
+ cURL: "#{URL}",
32
+ bAnnotations: true,
33
+ bGet: true,
34
+ cSubmitAs: "XML"
35
+ });
36
+ }
37
+ catch(e) {}
38
+ JS
39
+
40
+ pdf = PDF.new
41
+
42
+ pdf.append_page do |page|
43
+ page.Contents = contents
44
+ end
45
+
46
+ # Create a new action based on the script, compressed with zlib
47
+ jsaction = Action::JavaScript Stream.new(jscript)#@ Filter: :FlateDecode)
48
+
49
+ # Add the script into the document names dictionary.
50
+ # Any scripts registered here will be executed at the document opening (with no OpenAction implied).
51
+ pdf.register(Names::JAVASCRIPT, "Update", jsaction)
52
+
53
+ # Save the resulting file
54
+ pdf.save(OUTPUT_FILE)
55
+
56
+ puts "PDF file saved as #{OUTPUT_FILE}."
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/ruby
2
+
3
+ begin
4
+ require 'origami'
5
+ rescue LoadError
6
+ $: << File.join(__dir__, "../../lib")
7
+ require 'origami'
8
+ end
9
+ include Origami
10
+
11
+ OUTPUT_FILE = "#{File.basename(__FILE__, '.rb')}.pdf"
12
+ URL = "http://google.fr"
13
+
14
+ pdf = PDF.new
15
+
16
+ # Trigger an URI action when the document is opened.
17
+ pdf.onDocumentOpen Action::URI[URL]
18
+
19
+ pdf.save(OUTPUT_FILE)
20
+
21
+ puts "PDF file saved as #{OUTPUT_FILE}."
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/ruby
2
+
3
+ begin
4
+ require 'origami'
5
+ rescue LoadError
6
+ $: << File.join(__dir__, "../../lib")
7
+ require 'origami'
8
+ end
9
+ include Origami
10
+
11
+ OUTPUT_FILE = "#{File.basename(__FILE__, '.rb')}.pdf"
12
+ URL = "http://mydomain/calc.pdf"
13
+
14
+ pdf = PDF.new
15
+
16
+ contents = ContentStream.new
17
+ contents.write OUTPUT_FILE,
18
+ x: 210, y: 750, rendering: Text::Rendering::FILL, size: 30
19
+
20
+ contents.write "When opened, this PDF connects to \"home\"",
21
+ x: 156, y: 690, rendering: Text::Rendering::FILL, size: 15
22
+
23
+ contents.write "Click \"Allow\" to connect to #{URL} through your current Reader.",
24
+ x: 106, y: 670, size: 12
25
+
26
+ contents.write "Comments:",
27
+ x: 75, y: 600, rendering: Text::Rendering::FILL_AND_STROKE, size: 12
28
+
29
+ comment = <<-EOS
30
+ Adobe Reader will render the PDF file returned by the remote server.
31
+ EOS
32
+
33
+ contents.write comment,
34
+ x: 75, y: 580, rendering: Text::Rendering::FILL, size: 12
35
+
36
+ pdf.append_page Page.new.setContents(contents)
37
+
38
+ # Submit flags.
39
+ flags = Action::SubmitForm::Flags::EXPORTFORMAT|Action::SubmitForm::Flags::GETMETHOD
40
+
41
+ # Sends the form at the document opening.
42
+ pdf.onDocumentOpen Action::SubmitForm[URL, [], flags]
43
+
44
+ # Save the resulting file.
45
+ pdf.save(OUTPUT_FILE)
46
+
47
+ puts "PDF file saved as #{OUTPUT_FILE}."
@@ -1,55 +1,42 @@
1
1
  =begin
2
2
 
3
- = File
4
- origami.rb
3
+ This file is part of Origami, PDF manipulation framework for Ruby
4
+ Copyright (C) 2016 Guillaume Delugré.
5
5
 
6
- = Info
7
- Origami is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU Lesser General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
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.
11
10
 
12
- Origami is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU Lesser General Public License for more details.
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.
16
15
 
17
- You should have received a copy of the GNU Lesser General Public License
18
- along with Origami. If not, see <http://www.gnu.org/licenses/>.
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/>.
19
18
 
20
19
  =end
21
20
 
22
-
23
- if RUBY_VERSION < '1.9'
24
- class Fixnum
25
- def ord; self; end
26
- end
27
-
28
- class Hash
29
- alias key index
30
- end
31
- end
32
-
33
21
  module Origami
34
- VERSION = "1.2.6"
35
- REVISION = "$Revision$" #:nodoc:
36
22
 
37
- #
38
- # Global
39
- # options for Origami.
40
- #
41
- OPTIONS =
42
- {
43
- :enable_type_checking => true, # set to false to disable type consistency checks during compilation.
44
- :enable_type_guessing => true, # set to false to prevent the parser to guess the type of special dictionary and streams (not recommended).
45
- :enable_type_propagation => true, # set to false to prevent the parser to propagate type from parents to children.
46
- :use_openssl => true, # set to false to use Origami crypto backend.
47
- :ignore_bad_references => false, # set to interpret invalid references as Null objects, instead of raising an exception.
48
- :ignore_zlib_errors => false, # set to true to ignore exceptions on invalid Flate streams.
49
- }
23
+ #
24
+ # Global options for Origami.
25
+ #
26
+ OPTIONS =
27
+ {
28
+ enable_type_checking: true, # set to false to disable type consistency checks during compilation.
29
+ enable_type_guessing: true, # set to false to prevent the parser to guess the type of special dictionary and streams (not recommended).
30
+ enable_type_propagation: true, # set to false to prevent the parser to propagate type from parents to children.
31
+ use_openssl: true, # set to false to use Origami crypto backend.
32
+ ignore_bad_references: false, # set to interpret invalid references as Null objects, instead of raising an exception.
33
+ ignore_zlib_errors: false, # set to true to ignore exceptions on invalid Flate streams.
34
+ ignore_png_errors: false, # set to true to ignore exceptions on invalid PNG predictors.
35
+ }
36
+
37
+ autoload :FDF, 'origami/extensions/fdf'
38
+ autoload :PPKLite, 'origami/extensions/ppklite'
50
39
  end
51
40
 
41
+ require 'origami/version'
52
42
  require 'origami/pdf'
53
- require 'origami/extensions/fdf'
54
- require 'origami/extensions/ppklite'
55
-
@@ -1,239 +1,364 @@
1
1
  =begin
2
2
 
3
- = File
4
- 3d.rb
5
-
6
- = Info
7
- This file is part of Origami, PDF manipulation framework for Ruby
8
- Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org>
9
- All right reserved.
10
-
11
- Origami is free software: you can redistribute it and/or modify
12
- it under the terms of the GNU Lesser General Public License as published by
13
- the Free Software Foundation, either version 3 of the License, or
14
- (at your option) any later version.
15
-
16
- Origami is distributed in the hope that it will be useful,
17
- but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- GNU Lesser General Public License for more details.
20
-
21
- You should have received a copy of the GNU Lesser General Public License
22
- along with Origami. If not, see <http://www.gnu.org/licenses/>.
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/>.
23
18
 
24
19
  =end
25
20
 
26
21
  module Origami
27
22
 
28
- class Annotation
29
-
30
- #
31
- # 3D Artwork annotation.
32
- #
33
- class Artwork3D < Annotation
34
- field :Subtype, :Type => Name, :Default => :"3D", :Version => "1.6", :Required => true
35
- field :"3DD", :Type => [ Dictionary, Stream ], :Required => true
36
- field :"3DV", :Type => Object
37
- field :"3DA", :Type => Dictionary
38
- field :"3DI", :Type => Boolean, :Default => true
39
- field :"3DB", :Type => Array
40
-
41
- class Activation < Dictionary
23
+ class Projection3D < Dictionary
42
24
  include StandardObject
43
25
 
44
- module Events
45
- PAGE_OPEN = :PO
46
- PAGE_CLOSE = :PC
47
- PAGE_VISIBLE = :PV
48
- PAGE_INVISIBLE = :PI
49
- USER_ACTIVATE = :XA
50
- USER_DEACTIVATE = :XD
26
+ ORTHOGRAPHIC = :O
27
+ PERSPECTIVE = :P
28
+
29
+ module ClippingStyles
30
+ EXPLICIT_NEARFAR = :XNF
31
+ AUTOMATIC_NEARFAR = :ANF
51
32
  end
52
33
 
53
- module State
54
- UNINSTANCIATED = :U
55
- INSTANCIATED = :I
56
- LIVE = :L
34
+ module Scaling
35
+ WIDTH = :W
36
+ HEIGHT = :H
37
+ MINIMUM = :Min
38
+ MAXIMUM = :Max
39
+ ABSOLUTE = :Absolute
57
40
  end
58
41
 
59
- field :A, :Type => Name, :Default => Events::USER_ACTIVATE
60
- field :AIS, :Type => Name, :Default => State::LIVE
61
- field :D, :Type => Name, :Default => Events::PAGE_INVISIBLE
62
- field :DIS, :Type => Name, :Default => State::UNINSTANCIATED
63
- field :TB, :Type => Boolean, :Version => "1.7", :Default => true
64
- field :NP, :Type => Boolean, :Version => "1.7", :Default => false
65
- end
66
- end
67
-
68
- end
69
-
70
- class U3DStream < Stream
71
- include StandardObject
72
-
73
- field :Type, :Type => Name, :Default => :"3D"
74
- field :Subtype, :Type => Name, :Default => :U3D, :Required => true
75
- field :VA, :Type => Dictionary
76
- field :DV, :Type => Object
77
- field :Resources, :Type => Dictionary
78
- field :OnInstantiate, :Type => Stream
79
- field :AN, :Type => Dictionary
80
-
81
- def onInstantiate(action)
82
- self[:OnInstantiate] = action
83
- end
84
- end
85
-
86
- class AnimationStyle3D < Dictionary
87
- include StandardObject
88
-
89
- module Styles
90
- NONE = :None
91
- LINEAR = :Linear
92
- OSCILLATING = :Oscillating
93
- end
94
-
95
- field :Type, :Type => Name, :Default => "3DAnimationStyle"
96
- field :Subtype, :Type => Name, :Default => Styles::NONE
97
- field :PC, :Type => Integer, :Default => 0
98
- field :TM, :Type => Number, :Default => 1
99
- end
100
-
101
- class Reference3D < Dictionary
102
- include StandardObject
103
-
104
- field :Type, :Type => Name, :Default => :"3DRef"
105
- field :"3DD", :Type => Stream
106
- end
107
-
108
- class View3D < Dictionary
109
- include StandardObject
110
-
111
- field :Type, :Type => Name, :Default => :"3DView"
112
- field :XN, :Type => ByteString, :Required => true
113
- field :IN, :Type => ByteString
114
- field :MS, :Type => Name
115
- field :C2W, :Type => Array
116
- field :U3DPath, :Type => [ ByteString, Array ]
117
- field :CO, :Type => Number
118
- field :P, :Type => Dictionary
119
- field :O, :Type => Stream
120
- field :BG, :Type => Dictionary
121
- field :RM, :Type => Dictionary, :Version => "1.7"
122
- field :LS, :Type => Dictionary, :Version => "1.7"
123
- field :SA, :Type => Array, :Version => "1.7"
124
- field :NA, :Type => Array, :Version => "1.7"
125
- field :NR, :Type => Boolean, :Version => "1.7", :Default => false
126
- end
127
-
128
- class Projection3D < Dictionary
129
- include StandardObject
130
-
131
- ORTHOGRAPHIC = :O
132
- PERSPECTIVE = :P
133
-
134
- module ClippingStyles
135
- EXPLICIT_NEARFAR = :XNF
136
- AUTOMATIC_NEARFAR = :ANF
137
- end
138
-
139
- module Scaling
140
- WIDTH = :W
141
- HEIGHT = :H
142
- MINIMUM = :Min
143
- MAXIMUM = :Max
144
- ABSOLUTE = :Absolute
145
- end
146
-
147
- field :Subtype, :Type => Name, :Default => ORTHOGRAPHIC
148
- field :CS, :Type => Name, :Default => ClippingStyles::AUTOMATIC_NEARFAR
149
- field :F, :Type => Number
150
- field :N, :Type => Number
151
- field :FOV, :Type => Number
152
- field :PS, :Type => [ Number, Name ], :Default => Scaling::WIDTH
153
- field :OS, :Type => Number, :Default => 1
154
- field :OB, :Type => Name, :Version => "1.7", :Default => Scaling::ABSOLUTE
155
- end
156
-
157
- class Background3D < Dictionary
158
- include StandardObject
159
-
160
- field :Type, :Type => Name, :Default => :"3DBG"
161
- field :Subtype, :Type => Name, :Default => :SC
162
- field :CS, :Type => [ Name, Array ], :Default => Graphics::Color::Space::DEVICE_RGB
163
- field :C, :Type => Object, :Default => [ 1, 1, 1 ]
164
- field :EA, :Type => Boolean, :Default => false
165
- end
166
-
167
- class RenderMode3D < Dictionary
168
- include StandardObject
169
-
170
- module Modes
171
- SOLID = :Solid
172
- SOLID_WIREFRAME = :SolidWireFrame
173
- TRANSPARENT = :Transparent
174
- TRANSPARENT_WIREFRAME = :TransparentWireFrame
175
- BOUNDINGBOX = :BoundingBox
176
- TRANSPARENT_BOUNDINGBOX = :TransparentBoundingBox
177
- TRANSPARENT_BOUNDINGBOX_OUTLINE = :TransparentBoundingBoxOutline
178
- WIREFRAME = :WireFrame
179
- SHADED_WIREFRAME = :ShadedWireFrame
180
- HIDDEN_WIREFRAME = :HiddenWireFrame
181
- VERTICES = :Vertices
182
- SHADED_VERTICES = :ShadedVertices
183
- ILLUSTRATION = :Illustration
184
- SOLID_OUTLINE = :SolidOutline
185
- SHADED_ILLUSTRATION = :ShadedIllustration
186
- end
187
-
188
- field :Type, :Type => Name, :Default => :"3DRenderMode"
189
- field :Subtype, :Type => Name, :Required => true, :Version => "1.7"
190
- field :AC, :Type => Array, :Default => [ Graphics::Color::Space::DEVICE_RGB, 0, 0, 0]
191
- field :BG, :Type => [ Name, Array ], :Default => :BG
192
- field :O, :Type => Number, :Default => 0.5
193
- field :CV, :Type => Number, :Default => 45
194
- end
195
-
196
- class LightingScheme3D < Dictionary
197
- include StandardObject
198
-
199
- module Styles
200
- ARTWORK = :Artwork
201
- NONE = :None
202
- WHITE = :White
203
- DAY = :Day
204
- NIGHT = :Night
205
- HARD = :Hard
206
- PRIMARY = :Primary
207
- BLUE = :Blue
208
- RED = :Red
209
- CUBE = :Cube
210
- CAD = :CAD
211
- HEADLAMP = :HeadLamp
212
- end
213
-
214
- field :Type, :Type => Name, :Default => :"3DLightingScheme"
215
- field :Subtype, :Type => Name, :Version => "1.7", :Required => true
216
- end
217
-
218
- class CrossSection3D < Dictionary
219
- include StandardObject
220
-
221
- field :Type, :Type => Name, :Default => :"3DCrossSection"
222
- field :C, :Type => Array, :Default => [ 0, 0, 0 ]
223
- field :O, :Type => Array, :Version => "1.7", :Default => [ Null.new, 0, 0 ], :Required => true
224
- field :PO, :Type => Number, :Default => 0.5
225
- field :PC, :Type => Array, :Default => [ Graphics::Color::Space::DEVICE_RGB, 1, 1, 1 ]
226
- field :IV, :Type => Boolean, :Default => false
227
- field :IC, :Type => Array, :Default => [ Graphics::Color::Space::DEVICE_RGB, 0, 1 ,0]
228
- end
229
-
230
- class Node3D < Dictionary
231
- include StandardObject
232
-
233
- field :Type, :Type => Name, :Default => :"3DNode"
234
- field :N, :Type => ByteString, :Version => "1.7", :Required => true
235
- field :O, :Type => Number
236
- field :V, :Type => Boolean
237
- field :M, :Type => Array
238
- end
42
+ field :Subtype, :Type => Name, :Default => ORTHOGRAPHIC
43
+ field :CS, :Type => Name, :Default => ClippingStyles::AUTOMATIC_NEARFAR
44
+ field :F, :Type => Number
45
+ field :N, :Type => Number
46
+ field :FOV, :Type => Number
47
+ field :PS, :Type => [ Number, Name ], :Default => Scaling::WIDTH
48
+ field :OS, :Type => Number, :Default => 1
49
+ field :OB, :Type => Name, :Version => "1.7", :Default => Scaling::ABSOLUTE
50
+ end
51
+
52
+ class Background3D < Dictionary
53
+ include StandardObject
54
+
55
+ field :Type, :Type => Name, :Default => :"3DBG"
56
+ field :Subtype, :Type => Name, :Default => :SC
57
+ field :CS, :Type => [ Name, Array ], :Default => Graphics::Color::Space::DEVICE_RGB
58
+ field :C, :Type => Object, :Default => [ 1, 1, 1 ]
59
+ field :EA, :Type => Boolean, :Default => false
60
+ end
61
+
62
+ class RenderMode3D < Dictionary
63
+ include StandardObject
64
+
65
+ module Modes
66
+ SOLID = :Solid
67
+ SOLID_WIREFRAME = :SolidWireFrame
68
+ TRANSPARENT = :Transparent
69
+ TRANSPARENT_WIREFRAME = :TransparentWireFrame
70
+ BOUNDINGBOX = :BoundingBox
71
+ TRANSPARENT_BOUNDINGBOX = :TransparentBoundingBox
72
+ TRANSPARENT_BOUNDINGBOX_OUTLINE = :TransparentBoundingBoxOutline
73
+ WIREFRAME = :WireFrame
74
+ SHADED_WIREFRAME = :ShadedWireFrame
75
+ HIDDEN_WIREFRAME = :HiddenWireFrame
76
+ VERTICES = :Vertices
77
+ SHADED_VERTICES = :ShadedVertices
78
+ ILLUSTRATION = :Illustration
79
+ SOLID_OUTLINE = :SolidOutline
80
+ SHADED_ILLUSTRATION = :ShadedIllustration
81
+ end
82
+
83
+ field :Type, :Type => Name, :Default => :"3DRenderMode"
84
+ field :Subtype, :Type => Name, :Required => true, :Version => "1.7"
85
+ field :AC, :Type => Array, :Default => [ Graphics::Color::Space::DEVICE_RGB, 0, 0, 0]
86
+ field :BG, :Type => [ Name, Array ], :Default => :BG
87
+ field :O, :Type => Number, :Default => 0.5
88
+ field :CV, :Type => Number, :Default => 45
89
+ end
90
+
91
+ class LightingScheme3D < Dictionary
92
+ include StandardObject
93
+
94
+ module Styles
95
+ ARTWORK = :Artwork
96
+ NONE = :None
97
+ WHITE = :White
98
+ DAY = :Day
99
+ NIGHT = :Night
100
+ HARD = :Hard
101
+ PRIMARY = :Primary
102
+ BLUE = :Blue
103
+ RED = :Red
104
+ CUBE = :Cube
105
+ CAD = :CAD
106
+ HEADLAMP = :HeadLamp
107
+ end
108
+
109
+ field :Type, :Type => Name, :Default => :"3DLightingScheme"
110
+ field :Subtype, :Type => Name, :Version => "1.7", :Required => true
111
+ end
112
+
113
+ class CrossSection3D < Dictionary
114
+ include StandardObject
115
+
116
+ field :Type, :Type => Name, :Default => :"3DCrossSection"
117
+ field :C, :Type => Array, :Default => [ 0, 0, 0 ]
118
+ field :O, :Type => Array, :Version => "1.7", :Default => [ Null.new, 0, 0 ], :Required => true
119
+ field :PO, :Type => Number, :Default => 0.5
120
+ field :PC, :Type => Array, :Default => [ Graphics::Color::Space::DEVICE_RGB, 1, 1, 1 ]
121
+ field :IV, :Type => Boolean, :Default => false
122
+ field :IC, :Type => Array, :Default => [ Graphics::Color::Space::DEVICE_RGB, 0, 1 ,0]
123
+ end
124
+
125
+ class Node3D < Dictionary
126
+ include StandardObject
127
+
128
+ field :Type, :Type => Name, :Default => :"3DNode"
129
+ field :N, :Type => String, :Version => "1.7", :Required => true
130
+ field :O, :Type => Number
131
+ field :V, :Type => Boolean
132
+ field :M, :Type => Array
133
+ end
134
+
135
+ class Measurement3D < Dictionary
136
+ include StandardObject
137
+
138
+ field :Type, :Type => Name, :Default => :"3DMeasure"
139
+ field :Subtype, :Type => Name, :Required => true
140
+ field :TRL, :Type => String
141
+ end
142
+
143
+ class LinearDimensionMeasurement3D < Measurement3D
144
+ field :Subtype, :Type => Name, :Default => :L3D, :Required => true
145
+ field :AP, :Type => Array.of(Number, length: 3), :Required => true
146
+ field :A1, :Type => Array.of(Number, length: 3), :Required => true
147
+ field :N1, :Type => String
148
+ field :A2, :Type => Array.of(Number, length: 3), :Required => true
149
+ field :N2, :Type => String
150
+ field :TP, :Type => Array.of(Number, length: 3), :Required => true
151
+ field :TY, :Type => Array.of(Number, length: 3), :Required => true
152
+ field :TS, :Type => Number
153
+ field :C, :Type => Array.of(Number, length: 3)
154
+ field :V, :Type => Number, :Required => true
155
+ field :U, :Type => String, :Required => true
156
+ field :P, :Type => Integer, :Default => 3
157
+ field :UT, :Type => String
158
+ field :S, :Type => Annotation::Projection
159
+ end
160
+
161
+ class PerpendicularDimensionMeasurement3D < Measurement3D
162
+ field :Subtype, :Type => Name, :Default => :PD3, :Required => true
163
+ field :AP, :Type => Array.of(Number, length: 3), :Required => true
164
+ field :A1, :Type => Array.of(Number, length: 3), :Required => true
165
+ field :N1, :Type => String
166
+ field :A2, :Type => Array.of(Number, length: 3), :Required => true
167
+ field :N2, :Type => String
168
+ field :D1, :Type => Array.of(Number, length: 3), :Required => true
169
+ field :TP, :Type => Array.of(Number, length: 3), :Required => true
170
+ field :TY, :Type => Array.of(Number, length: 3), :Required => true
171
+ field :TS, :Type => Number
172
+ field :C, :Type => Array.of(Number, length: 3)
173
+ field :V, :Type => Number, :Required => true
174
+ field :U, :Type => String, :Required => true
175
+ field :P, :Type => Integer, :Default => 3
176
+ field :UT, :Type => String
177
+ field :S, :Type => Annotation::Projection
178
+ end
179
+
180
+ class AngularDimensionMeasurement3D < Measurement3D
181
+ field :Subtype, :Type => Name, :Default => :AD3, :Required => true
182
+ field :AP, :Type => Array.of(Number, length: 3), :Required => true
183
+ field :A1, :Type => Array.of(Number, length: 3), :Required => true
184
+ field :D1, :Type => Array.of(Number, length: 3), :Required => true
185
+ field :N1, :Type => String
186
+ field :A2, :Type => Array.of(Number, length: 3), :Required => true
187
+ field :D2, :Type => Array.of(Number, length: 3), :Required => true
188
+ field :N2, :Type => String
189
+ field :TP, :Type => Array.of(Number, length: 3), :Required => true
190
+ field :TX, :Type => Array.of(Number, length: 3), :Required => true
191
+ field :TY, :Type => Array.of(Number, length: 3), :Required => true
192
+ field :TS, :Type => Number
193
+ field :C, :Type => Array.of(Number, length: 3)
194
+ field :V, :Type => Number, :Required => true
195
+ field :P, :Type => Integer, :Default => 3
196
+ field :UT, :Type => String
197
+ field :DR, :Type => Boolean, :Default => true
198
+ field :S, :Type => Annotation::Projection
199
+ end
200
+
201
+ class RadialMeasurement3D < Measurement3D
202
+ field :Subtype, :Type => Name, :Default => :RD3, :Required => true
203
+ field :AP, :Type => Array.of(Number, length: 3), :Required => true
204
+ field :A1, :Type => Array.of(Number, length: 3), :Required => true
205
+ field :A2, :Type => Array.of(Number, length: 3), :Required => true
206
+ field :N2, :Type => String
207
+ field :A3, :Type => Array.of(Number, length: 3), :Required => true
208
+ field :A4, :Type => Array.of(Number, length: 3), :Required => true
209
+ field :TP, :Type => Array.of(Number, length: 3), :Required => true
210
+ field :TX, :Type => Array.of(Number, length: 3), :Required => true
211
+ field :TY, :Type => Array.of(Number, length: 3), :Required => true
212
+ field :EL, :Type => Number, :Default => 60
213
+ field :TS, :Type => Number
214
+ field :C, :Type => Array.of(Number, length: 3)
215
+ field :V, :Type => Number, :Required => true
216
+ field :U, :Type => String, :Required => true
217
+ field :P, :Type => Integer, :Default => 3
218
+ field :UT, :Type => String
219
+ field :SC, :Type => Boolean, :Default => false
220
+ field :R, :Type => Boolean, :Default => true
221
+ field :S, :Type => Annotation::Projection
222
+ end
223
+
224
+ class CommentNote3D < Measurement3D
225
+ field :Subtype, :Type => Name, :Default => :"3DC", :Required => true
226
+ field :A1, :Type => Array.of(Number, length: 3), :Required => true
227
+ field :N1, :Type => String
228
+ field :TP, :Type => Array.of(Number, length: 3), :Required => true
229
+ field :TB, :Type => Array.of(Integer, length: 2)
230
+ field :TS, :Type => Number
231
+ field :C, :Type => Array.of(Number, length: 3)
232
+ field :UT, :Type => String
233
+ field :S, :Type => Annotation::Projection
234
+ end
235
+
236
+ class View3D < Dictionary
237
+ include StandardObject
238
+
239
+ field :Type, :Type => Name, :Default => :"3DView"
240
+ field :XN, :Type => String, :Required => true
241
+ field :IN, :Type => String
242
+ field :MS, :Type => Name
243
+ field :C2W, :Type => Array
244
+ field :U3DPath, :Type => [ String, Array.of(String) ]
245
+ field :CO, :Type => Number
246
+ field :P, :Type => Projection3D
247
+ field :O, :Type => Graphics::FormXObject
248
+ field :BG, :Type => Background3D
249
+ field :RM, :Type => RenderMode3D, :Version => "1.7"
250
+ field :LS, :Type => LightingScheme3D, :Version => "1.7"
251
+ field :SA, :Type => Array.of(CrossSection3D), :Version => "1.7"
252
+ field :NA, :Type => Array.of(Node3D), :Version => "1.7"
253
+ field :NR, :Type => Boolean, :Version => "1.7", :Default => false
254
+ end
255
+
256
+ class AnimationStyle3D < Dictionary
257
+ include StandardObject
258
+
259
+ module Styles
260
+ NONE = :None
261
+ LINEAR = :Linear
262
+ OSCILLATING = :Oscillating
263
+ end
264
+
265
+ field :Type, :Type => Name, :Default => :"3DAnimationStyle"
266
+ field :Subtype, :Type => Name, :Default => Styles::NONE
267
+ field :PC, :Type => Integer, :Default => 0
268
+ field :TM, :Type => Number, :Default => 1
269
+ end
270
+
271
+ class U3DStream < Stream
272
+ include StandardObject
273
+
274
+ module Type
275
+ U3D = :U3D
276
+ PRC = :PRC
277
+ end
278
+
279
+ field :Type, :Type => Name, :Default => :"3D"
280
+ field :Subtype, :Type => Name, :Default => Type::U3D, :Required => true, :Version => "1.7", :ExtensionLevel => 3
281
+ field :VA, :Type => Array.of(View3D)
282
+ field :DV, :Type => Object
283
+ field :Resources, :Type => Dictionary
284
+ field :OnInstantiate, :Type => Stream
285
+ field :AN, :Type => AnimationStyle3D
286
+
287
+ def onInstantiate(action)
288
+ self[:OnInstantiate] = action
289
+ end
290
+ end
291
+
292
+ class Reference3D < Dictionary
293
+ include StandardObject
294
+
295
+ field :Type, :Type => Name, :Default => :"3DRef"
296
+ field :"3DD", :Type => U3DStream
297
+ end
298
+
299
+ class Units3D < Dictionary
300
+ include StandardObject
301
+
302
+ field :TSm, :Type => Number, :Default => 1.0
303
+ field :TSn, :Type => Number, :Default => 1.0
304
+ field :TU, :Type => String
305
+ field :USm, :Type => Number, :Default => 1.0
306
+ field :USn, :Type => Number, :Default => 1.0
307
+ field :UU, :Type => String
308
+ field :DSm, :Type => Number, :Default => 1.0
309
+ field :DSn, :Type => Number, :Default => 1.0
310
+ field :DU, :Type => String
311
+ end
312
+
313
+ class Annotation
314
+
315
+ #
316
+ # 3D Artwork annotation.
317
+ #
318
+ class Artwork3D < Annotation
319
+
320
+ class Activation < Dictionary
321
+ include StandardObject
322
+
323
+ module Events
324
+ PAGE_OPEN = :PO
325
+ PAGE_CLOSE = :PC
326
+ PAGE_VISIBLE = :PV
327
+ PAGE_INVISIBLE = :PI
328
+ USER_ACTIVATE = :XA
329
+ USER_DEACTIVATE = :XD
330
+ end
331
+
332
+ module State
333
+ UNINSTANCIATED = :U
334
+ INSTANCIATED = :I
335
+ LIVE = :L
336
+ end
337
+
338
+ module Style
339
+ EMBEDDED = :Embedded
340
+ WINDOWED = :Windowed
341
+ end
342
+
343
+ field :A, :Type => Name, :Default => Events::USER_ACTIVATE
344
+ field :AIS, :Type => Name, :Default => State::LIVE
345
+ field :D, :Type => Name, :Default => Events::PAGE_INVISIBLE
346
+ field :DIS, :Type => Name, :Default => State::UNINSTANCIATED
347
+ field :TB, :Type => Boolean, :Version => "1.7", :Default => true
348
+ field :NP, :Type => Boolean, :Version => "1.7", :Default => false
349
+ field :Style, :Type => Name, :Version => "1.7", :ExtensionLevel => 3, :Default => Style::EMBEDDED
350
+ field :Window, :Type => RichMedia::Window, :Version => "1.7", :ExtensionLevel => 3
351
+ field :Transparent, :Type => Boolean, :Version => "1.7", :ExtensionLevel => 3, :Default => false
352
+ end
353
+
354
+ field :Subtype, :Type => Name, :Default => :"3D", :Version => "1.6", :Required => true
355
+ field :"3DD", :Type => [ Reference3D, U3DStream ], :Required => true
356
+ field :"3DV", :Type => Object
357
+ field :"3DA", :Type => Activation
358
+ field :"3DI", :Type => Boolean, :Default => true
359
+ field :"3DB", :Type => Rectangle
360
+ field :"3DU", :Type => Units3D, :Version => "1.7", :ExtensionLevel => 3
361
+ end
362
+ end
363
+
239
364
  end