summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/lpdf-wid.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/lpdf-wid.lua')
-rw-r--r--tex/context/base/mkiv/lpdf-wid.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua
index b8648b32a..8e0a45a00 100644
--- a/tex/context/base/mkiv/lpdf-wid.lua
+++ b/tex/context/base/mkiv/lpdf-wid.lua
@@ -252,20 +252,25 @@ job.register('job.fileobjreferences.collected', tobesavedobjrefs, initializer)
local function flushembeddedfiles()
if enabled and next(filestreams) then
local e = pdfarray()
+ local f = pdfarray()
for tag, reference in sortedhash(filestreams) do
if not reference then
report_attachment("unreferenced file, tag %a",tag)
--- elseif referenced[tag] == "hidden" then
- elseif referenced[tag] ~= "hidden" then
+ elseif referenced[tag] == "hidden" then
e[#e+1] = pdfstring(tag)
e[#e+1] = reference -- already a reference
+ f[#f+1] = reference -- collect all file description references
else
- -- -- messy spec ... when annot not in named else twice in menu list acrobat
+ -- messy spec ... when annot not in named else twice in menu list acrobat
+ f[#f+1] = reference
end
end
if #e > 0 then
lpdf.addtonames("EmbeddedFiles",pdfreference(pdfflushobject(pdfdictionary{ Names = e })))
end
+ if #f > 0 then -- PDF/A-2|3: all associated files must have a relationship to the PDF document (global or part)
+ lpdf.addtocatalog("AF", pdfreference(pdfflushobject(f))) -- global (Catalog)
+ end
end
end
@@ -430,6 +435,7 @@ function nodeinjections.attachfile(specification)
else
referenced[hash] = "annotation"
local name, appearance = analyzesymbol(specification.symbol,attachment_symbols)
+ local flags = specification.flags or 0 -- to keep it expandable
local d = pdfdictionary {
Subtype = pdfconstant("FileAttachment"),
FS = aref,
@@ -442,7 +448,8 @@ function nodeinjections.attachfile(specification)
CA = analyzetransparency(specification.transparencyvalue),
AP = appearance,
OC = analyzelayer(specification.layer),
- F = pdfnull(), -- another rediculous need to satisfy validation
+ -- F = pdfnull(), -- another rediculous need to satisfy validation
+ F = (flags | 4) & (1023-1-2-32-256), -- set 3, clear 1,2,6,9; PDF 32000-1, p385
}
local width = specification.width or 0
local height = specification.height or 0
@@ -534,7 +541,6 @@ function nodeinjections.comment(specification) -- brrr: seems to be done twice
Name = name,
NM = pdfstring("comment:"..nofcomments),
AP = appearance,
- F = pdfnull(), -- another rediculous need to satisfy validation
}
local width = specification.width or 0
local height = specification.height or 0