summaryrefslogtreecommitdiff
path: root/tex/context/base/lpdf-nod.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2010-07-04 15:32:09 +0300
committerMarius <mariausol@gmail.com>2010-07-04 15:32:09 +0300
commit85b7bc695629926641c7cb752fd478adfdf374f3 (patch)
tree80293f5aaa7b95a500a78392c39688d8ee7a32fc /tex/context/base/lpdf-nod.lua
downloadcontext-85b7bc695629926641c7cb752fd478adfdf374f3.tar.gz
stable 2010-05-24 13:10
Diffstat (limited to 'tex/context/base/lpdf-nod.lua')
-rw-r--r--tex/context/base/lpdf-nod.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/tex/context/base/lpdf-nod.lua b/tex/context/base/lpdf-nod.lua
new file mode 100644
index 000000000..0ae900123
--- /dev/null
+++ b/tex/context/base/lpdf-nod.lua
@@ -0,0 +1,53 @@
+if not modules then modules = { } end modules ['lpdf-nod'] = {
+ 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"
+}
+
+local copy_node, new_node = node.copy, node.new
+
+local pdfliteral = nodes.register(new_node("whatsit", 8)) pdfliteral.mode = 1
+local pdfdest = nodes.register(new_node("whatsit",19)) pdfdest.named_id = 1 -- xyz_zoom untouched
+local pdfannot = nodes.register(new_node("whatsit",15))
+
+local variables = interfaces.variables
+
+local views = { -- beware, we do support the pdf keys but this is *not* official
+ xyz = 0, [variables.standard] = 0,
+ fit = 1, [variables.fit] = 1,
+ fith = 2, [variables.width] = 2,
+ fitv = 3, [variables.height] = 3,
+ fitb = 4,
+ fitbh = 5, [variables.minwidth] = 5,
+ fitbv = 6, [variables.minheight] = 6,
+ fitr = 7,
+}
+
+function nodes.pdfliteral(str)
+ local t = copy_node(pdfliteral)
+ t.data = str
+ return t
+end
+
+function nodes.pdfannotation(w,h,d,data,n)
+ local t = copy_node(pdfannot)
+ if w and w ~= 0 then t.width = w end
+ if h and h ~= 0 then t.height = h end
+ if d and d ~= 0 then t.depth = d end
+ if n then t.objnum = n end
+ if data and data ~= "" then t.data = data end
+ return t
+end
+
+function nodes.pdfdestination(w,h,d,name,view,n)
+ local t = copy_node(pdfdest)
+ if w and w ~= 0 then t.width = w end
+ if h and h ~= 0 then t.height = h end
+ if d and d ~= 0 then t.depth = d end
+ if n then t.objnum = n end
+ t.dest_id = name
+ t.dest_type = views[view] or view or 1 -- fit is default
+ return t
+end