summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/lpdf-swf.lua
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2010-05-24 14:05:02 +0000
committerTaco Hoekwater <taco@elvenkind.com>2010-05-24 14:05:02 +0000
commit57ea7dad48fbf2541c04e434c31bde655ada3ac4 (patch)
tree1f8b43bc7cb92939271e1f5bec610710be69097f /Master/texmf-dist/tex/context/base/lpdf-swf.lua
parent6ee41e1f1822657f7f23231ec56c0272de3855e3 (diff)
here is context 2010.05.24 13:05
git-svn-id: svn://tug.org/texlive/trunk@18445 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/lpdf-swf.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/lpdf-swf.lua109
1 files changed, 109 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/lpdf-swf.lua b/Master/texmf-dist/tex/context/base/lpdf-swf.lua
new file mode 100644
index 00000000000..9fe0cd09fc8
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/lpdf-swf.lua
@@ -0,0 +1,109 @@
+if not modules then modules = { } end modules ['lpdf-swf'] = {
+ version = 1.001,
+ comment = "companion to lpdf-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- The following code is based on tests by Luigi Scarso. His prototype
+-- was using tex code. This is the official implementation.
+
+local format = string.format
+
+local pdfconstant = lpdf.constant
+local pdfboolean = lpdf.boolean
+local pdfstring = lpdf.string
+local pdfunicode = lpdf.unicode
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfnull = lpdf.null
+local pdfreference = lpdf.reference
+
+function backends.pdf.helpers.insertswf(spec)
+
+ local width, height, filename = spec.width, spec.height, spec.foundname
+
+ local eref = backends.codeinjections.embedfile(filename)
+
+ local flash = pdfdictionary {
+ Subtype = pdfconstant("Flash"),
+ Instances = pdfarray {
+ pdfdictionary {
+ Asset = eref,
+ Params = pdfdictionary {
+ Binding = pdfconstant("Foreground")
+ }
+ },
+ },
+ }
+
+ local fref = pdfreference(pdf.immediateobj(tostring(flash)))
+
+ local configuration = pdfdictionary {
+ Configurations = pdfarray { fref },
+ Assets = pdfdictionary {
+ Names = pdfarray {
+ pdfstring(filename),
+ eref,
+ }
+ },
+ }
+
+ local cref = pdfreference(pdf.immediateobj(tostring(configuration)))
+
+ local activation = pdfdictionary {
+ Activation = pdfdictionary {
+ Type = pdfconstant("RichMediaActivation"),
+ Condition = pdfconstant("PO"),
+ Configuration = fref,
+ Animation = pdfdictionary {
+ Subtype = pdfconstant("Linear"),
+ Speed = 1,
+ Playcount = 1,
+ },
+ Deactivation = pdfdictionary {
+ Type = pdfconstant("RichMediaDeactivation"),
+ Condition = pdfconstant("XD"),
+ },
+ Presentation = pdfdictionary {
+ PassContextClick = false,
+ Style = pdfconstant("Embedded"),
+ Toolbar = false,
+ NavigationPane = false,
+ Transparent = true,
+ Window = pdfdictionary {
+ Type = pdfconstant("RichMediaWindow"),
+ Width = pdfdictionary {
+ Default = 100,
+ Min = 100,
+ Max = 100,
+ },
+ Height = pdfdictionary {
+ Default = 100,
+ Min = 100,
+ Max = 100,
+ },
+ Position = pdfdictionary {
+ Type = pdfconstant("RichMediaPosition"),
+ HAlign = pdfconstant("Near"),
+ VAlign = pdfconstant("Near"),
+ HOffset = 0,
+ VOffset = 0,
+ }
+ }
+ }
+ }
+ }
+
+ local aref = pdfreference(pdf.immediateobj(tostring(activation)))
+
+ local annotation = pdfdictionary {
+ Subtype = pdfconstant("RichMedia"),
+ RichMediaContent = cref,
+ RichMediaSettings = aref,
+ }
+
+ return annotation, nil, nil
+
+end