diff options
Diffstat (limited to 'tex/context/base/lpdf-wid.lua')
-rw-r--r-- | tex/context/base/lpdf-wid.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua index 7b535d1b1..0d96d8086 100644 --- a/tex/context/base/lpdf-wid.lua +++ b/tex/context/base/lpdf-wid.lua @@ -163,6 +163,23 @@ local nofattachments, attachments, filestreams = 0, { }, { } -- todo: hash and embed once +local function flushembeddedfiles() + if next(filestreams) then + local e = pdfarray() + for name, reference in next, filestreams do + if reference then + e[#e+1] = pdfstring(name) + e[#e+1] = reference -- already a reference + else + -- we can issue a message + end + end + lpdf.addtonames("EmbeddedFiles",pdfreference(pdfflushobject(pdfdictionary{ Names = e }))) + end +end + +lpdf.registerdocumentfinalizer(flushembeddedfiles,"embeddedfiles") + function codeinjections.embedfile(filename) local r = filestreams[filename] if r == false then |