back-pdf.lmt /size: 1577 b    last modification: 2021-10-28 13:50
1if not modules then modules = { } end modules ['back-pdf'] = {
2    version   = 1.001,
3    comment   = "companion to back-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. If needed I will provide replacement functionality.
12
13local setmetatableindex = table.setmetatableindex
14
15local pdfsetcompression  = lpdf.setcompression
16local pdfimmediateobject = lpdf.immediateobject
17
18interfaces.implement {
19    name      = "setpdfcompression",
20    arguments = { "integer", "integer" },
21    actions   = function(...) pdfsetcompression(...) end,
22}
23
24do
25
26    local dummy  = function() end
27    local report = logs.reporter("backend")
28
29    local function unavailable(t,k)
30        report("calling unavailable pdf.%s function",k)
31        t[k] = dummy
32        return dummy
33    end
34
35    updaters.register("backend.update",function()
36        --
37        -- For now we keep this for tikz. If really needed some more can be made
38        -- accessible but it has to happen in a controlled way then, for instance
39        -- by first loading or enabling some compatibility layer so that we can
40        -- trace possible interferences.
41        --
42        pdf = {
43            immediateobj = pdfimmediateobject
44        }
45        setmetatableindex(pdf,unavailable)
46    end)
47
48end
49
50backends.install("pdf")
51