origami 1.2.7 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -0
- data/README.md +112 -0
- data/bin/config/pdfcop.conf.yml +232 -233
- data/bin/gui/about.rb +27 -37
- data/bin/gui/config.rb +108 -117
- data/bin/gui/file.rb +416 -365
- data/bin/gui/gtkhex.rb +1138 -1153
- data/bin/gui/hexview.rb +55 -57
- data/bin/gui/imgview.rb +48 -51
- data/bin/gui/menu.rb +388 -386
- data/bin/gui/properties.rb +114 -130
- data/bin/gui/signing.rb +571 -617
- data/bin/gui/textview.rb +77 -95
- data/bin/gui/treeview.rb +382 -387
- data/bin/gui/walker.rb +227 -232
- data/bin/gui/xrefs.rb +56 -60
- data/bin/pdf2pdfa +53 -57
- data/bin/pdf2ruby +212 -228
- data/bin/pdfcop +338 -348
- data/bin/pdfdecompress +58 -65
- data/bin/pdfdecrypt +56 -60
- data/bin/pdfencrypt +75 -80
- data/bin/pdfexplode +185 -182
- data/bin/pdfextract +201 -218
- data/bin/pdfmetadata +83 -82
- data/bin/pdfsh +4 -5
- data/bin/pdfwalker +1 -2
- data/bin/shell/.irbrc +45 -82
- data/bin/shell/console.rb +105 -130
- data/bin/shell/hexdump.rb +40 -64
- 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/{samples/actions/triggerevents/trigger.rb → examples/events/events.rb} +13 -16
- data/examples/flash/flash.rb +37 -0
- data/{samples → 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.rb +29 -42
- data/lib/origami/3d.rb +350 -225
- data/lib/origami/acroform.rb +262 -288
- data/lib/origami/actions.rb +268 -288
- data/lib/origami/annotations.rb +697 -722
- data/lib/origami/array.rb +258 -184
- data/lib/origami/boolean.rb +74 -84
- data/lib/origami/catalog.rb +397 -434
- data/lib/origami/collections.rb +144 -0
- data/lib/origami/destinations.rb +233 -194
- data/lib/origami/dictionary.rb +253 -232
- data/lib/origami/encryption.rb +1274 -1243
- data/lib/origami/export.rb +232 -268
- data/lib/origami/extensions/fdf.rb +307 -220
- data/lib/origami/extensions/ppklite.rb +368 -435
- data/lib/origami/filespec.rb +197 -0
- data/lib/origami/filters.rb +301 -295
- data/lib/origami/filters/ascii.rb +177 -180
- data/lib/origami/filters/ccitt.rb +528 -535
- data/lib/origami/filters/crypt.rb +26 -35
- data/lib/origami/filters/dct.rb +46 -52
- data/lib/origami/filters/flate.rb +95 -94
- data/lib/origami/filters/jbig2.rb +49 -55
- data/lib/origami/filters/jpx.rb +38 -44
- data/lib/origami/filters/lzw.rb +189 -183
- data/lib/origami/filters/predictors.rb +221 -235
- data/lib/origami/filters/runlength.rb +103 -104
- data/lib/origami/font.rb +173 -186
- data/lib/origami/functions.rb +67 -81
- data/lib/origami/graphics.rb +25 -21
- data/lib/origami/graphics/colors.rb +178 -187
- data/lib/origami/graphics/instruction.rb +79 -85
- data/lib/origami/graphics/path.rb +142 -148
- data/lib/origami/graphics/patterns.rb +160 -167
- data/lib/origami/graphics/render.rb +43 -50
- data/lib/origami/graphics/state.rb +138 -153
- data/lib/origami/graphics/text.rb +188 -205
- data/lib/origami/graphics/xobject.rb +819 -815
- data/lib/origami/header.rb +63 -78
- data/lib/origami/javascript.rb +596 -597
- data/lib/origami/linearization.rb +285 -290
- data/lib/origami/metadata.rb +139 -148
- data/lib/origami/name.rb +112 -148
- data/lib/origami/null.rb +53 -62
- data/lib/origami/numeric.rb +162 -175
- data/lib/origami/obfuscation.rb +186 -174
- data/lib/origami/object.rb +593 -573
- data/lib/origami/outline.rb +42 -47
- data/lib/origami/outputintents.rb +73 -82
- data/lib/origami/page.rb +703 -592
- data/lib/origami/parser.rb +238 -290
- data/lib/origami/parsers/fdf.rb +41 -33
- data/lib/origami/parsers/pdf.rb +75 -95
- data/lib/origami/parsers/pdf/lazy.rb +137 -0
- data/lib/origami/parsers/pdf/linear.rb +64 -66
- data/lib/origami/parsers/ppklite.rb +34 -70
- data/lib/origami/pdf.rb +1030 -1005
- data/lib/origami/reference.rb +102 -102
- data/lib/origami/signature.rb +591 -609
- data/lib/origami/stream.rb +668 -551
- data/lib/origami/string.rb +397 -373
- data/lib/origami/template/patterns.rb +56 -0
- data/lib/origami/template/widgets.rb +151 -0
- data/lib/origami/trailer.rb +144 -158
- data/lib/origami/tree.rb +62 -0
- data/lib/origami/version.rb +23 -0
- data/lib/origami/webcapture.rb +88 -79
- data/lib/origami/xfa.rb +2863 -2882
- data/lib/origami/xreftable.rb +472 -384
- data/test/dataset/calc.pdf +85 -0
- data/test/dataset/crypto.pdf +82 -0
- data/test/dataset/empty.pdf +49 -0
- data/test/test_actions.rb +27 -0
- data/test/test_annotations.rb +90 -0
- data/test/test_pages.rb +31 -0
- data/test/test_pdf.rb +16 -0
- data/test/test_pdf_attachment.rb +34 -0
- data/test/test_pdf_create.rb +24 -0
- data/test/test_pdf_encrypt.rb +95 -0
- data/test/test_pdf_parse.rb +96 -0
- data/test/test_pdf_sign.rb +58 -0
- data/test/test_streams.rb +182 -0
- data/test/test_xrefs.rb +67 -0
- metadata +88 -58
- data/README +0 -67
- data/bin/pdf2graph +0 -121
- data/bin/pdfcocoon +0 -104
- data/lib/origami/file.rb +0 -233
- data/samples/README.txt +0 -45
- data/samples/actions/launch/calc.rb +0 -87
- data/samples/actions/launch/winparams.rb +0 -22
- data/samples/actions/loop/loopgoto.rb +0 -24
- data/samples/actions/loop/loopnamed.rb +0 -21
- data/samples/actions/named/named.rb +0 -31
- data/samples/actions/samba/smbrelay.rb +0 -26
- data/samples/actions/webbug/submitform.js +0 -26
- data/samples/actions/webbug/webbug-browser.rb +0 -68
- data/samples/actions/webbug/webbug-js.rb +0 -67
- data/samples/actions/webbug/webbug-reader.rb +0 -90
- data/samples/attachments/attach.rb +0 -40
- data/samples/attachments/attached.txt +0 -1
- data/samples/crypto/crypto.rb +0 -28
- data/samples/digsig/signed.rb +0 -46
- data/samples/exploits/cve-2008-2992-utilprintf.rb +0 -87
- data/samples/exploits/cve-2009-0927-geticon.rb +0 -65
- data/samples/exploits/exploit_customdictopen.rb +0 -55
- data/samples/exploits/getannots.rb +0 -69
- data/samples/flash/flash.rb +0 -31
- data/samples/javascript/attached.txt +0 -1
- data/samples/javascript/js.rb +0 -52
- data/templates/patterns.rb +0 -66
- data/templates/widgets.rb +0 -173
- data/templates/xdp.rb +0 -92
- 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}."
|
data/lib/origami.rb
CHANGED
@@ -1,55 +1,42 @@
|
|
1
1
|
=begin
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
This file is part of Origami, PDF manipulation framework for Ruby
|
4
|
+
Copyright (C) 2016 Guillaume Delugré.
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
18
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
data/lib/origami/3d.rb
CHANGED
@@ -1,239 +1,364 @@
|
|
1
1
|
=begin
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
54
|
-
|
55
|
-
|
56
|
-
|
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 :
|
60
|
-
field :
|
61
|
-
field :
|
62
|
-
field :
|
63
|
-
field :
|
64
|
-
field :
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
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
|