back-imp-pdf.lmt /size: 1836 b    last modification: 2021-10-28 13:50
1if not modules then modules = { } end modules ['back-imp-pdf'] = {
2    version   = 1.001,
3    comment   = "companion to back-imp-pdf.mkiv",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files"
7}
8
9-- We hide the pdf table from users so that we can guarantee no interference with
10-- the way we manage resources, info, etc. Users should use the \type {lpdf}
11-- interface instead. For now we have a little for tikz. If really needed some more
12-- can be made accessible but it has to happen in a controlled way then, for
13-- instance by first loading or enabling some compatibility layer so that we can
14-- trace possible interferences.
15
16updaters.register("backends.pdf.latebindings",function()
17    --
18    local dummy  = function() end
19    local report = logs.reporter("backend")
20    --
21    -- For now we keep this for tikz. If really needed some more can be made
22    -- accessible but it has to happen in a controlled way then, for instance
23    -- by first loading or enabling some compatibility layer so that we can
24    -- trace possible interferences.
25    --
26    pdf = {
27        immediateobj = lpdf.immediateobject
28    }
29
30    table.setmetatableindex(pdf,function(t,k)
31        report("calling unavailable pdf.%s function",k)
32        t[k] = dummy
33        return dummy
34    end)
35
36end)
37
38-- The compression setter is defined here because it's probably the only macro
39-- that is used independent of a driver being chosen. It's easier this way than
40-- checking in other ways unless we add some generic compression setting to
41-- all drivers.
42
43interfaces.implement {
44    name      = "setpdfcompression",
45    arguments = { "integer", "integer" },
46    actions   = lpdf.setcompression,
47}
48
49-- The pdf driver itself is installed in lpdf-lmt.lmt!
50