summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/lpdf-xmp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/lpdf-xmp.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lpdf-xmp.lua75
1 files changed, 35 insertions, 40 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lpdf-xmp.lua b/Master/texmf-dist/tex/context/base/mkiv/lpdf-xmp.lua
index 508bb19976d..eb15a358287 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lpdf-xmp.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lpdf-xmp.lua
@@ -11,7 +11,6 @@ local tostring, type = tostring, type
local format, gsub = string.format, string.gsub
local utfchar = utf.char
local xmlfillin = xml.fillin
-local md5HEX = md5.HEX
local trace_xmp = false trackers.register("backend.xmp", function(v) trace_xmp = v end)
local trace_info = false trackers.register("backend.info", function(v) trace_info = v end)
@@ -34,7 +33,7 @@ local pdfgetmetadata = lpdf.getmetadata
-- XMP-Toolkit-SDK-CC201607.zip. So we hardcode the id.
local xpacket = format ( [[
-<?xpacket begin="%s" id="W5M0MpCehiHzreSzNTczkc9d"?>
+<?xpacket begin="%s" id="W5M0MpCehiHzreSzNTczkc9d"?>
%%s
@@ -47,8 +46,7 @@ local mapping = {
["ConTeXt.Url"] = { "context", "rdf:Description/pdfx:ConTeXt.Url" },
["ConTeXt.Support"] = { "context", "rdf:Description/pdfx:ConTeXt.Support" },
["ConTeXt.Version"] = { "context", "rdf:Description/pdfx:ConTeXt.Version" },
- ["ConTeXt.LMTX"] = { "context", "rdf:Description/pdfx:ConTeXt.LMTX" },
- ["TeX.Support"] = { "metadata","rdf:Description/pdfx:TeX.Support" },
+ ["TeX.Support"] = { "metadata", "rdf:Description/pdfx:TeX.Support" },
["LuaTeX.Version"] = { "metadata","rdf:Description/pdfx:LuaTeX.Version" },
["LuaTeX.Functionality"] = { "metadata","rdf:Description/pdfx:LuaTeX.Functionality" },
["LuaTeX.LuaVersion"] = { "metadata","rdf:Description/pdfx:LuaTeX.LuaVersion" },
@@ -91,7 +89,7 @@ local mapping = {
["CaptionWriter"] = { "metadata", "rdf:Description/photoshop:CaptionWriter" },
}
-lpdf.setsuppressoptionalinfo (
+pdf.setsuppressoptionalinfo(
0 --
+ 1 -- pdfnofullbanner
+ 2 -- pdfnofilename
@@ -106,62 +104,59 @@ lpdf.setsuppressoptionalinfo (
)
local included = backends.included
-local lpdfid = lpdf.id
+
+local pdfsettrailerid = pdf.settrailerid
+
+local lpdfid = lpdf.id
function lpdf.id() -- overload of ini
return lpdfid(included.date)
end
-local settrailerid = lpdf.settrailerid -- this is the wrapped one
-
-local trailerid = nil
-local dates = nil
+pdf.disablecommand("settrailerid")
-local function update()
- if trailer_id then
- local b = toboolean(trailer_id) or trailer_id == ""
+function lpdf.settrailerid(v)
+ if v then
+ local b = toboolean(v) or v == ""
if b then
- trailer_id = "This file is processed by ConTeXt and LuaTeX."
+ v = "This file is processed by ConTeXt and LuaTeX."
else
- trailer_id = tostring(trailer_id)
+ v = tostring(v)
end
- local h = md5HEX(trailer_id)
+ local h = md5.HEX(v)
if b then
report_info("using frozen trailer id")
else
- report_info("using hashed trailer id %a (%a)",trailer_id,h)
+ report_info("using hashed trailer id %a (%a)",v,h)
end
- settrailerid(format("[<%s> <%s>]",h,h))
+ pdfsettrailerid(format("[<%s> <%s>]",h,h))
end
- --
- local t = type(dates)
+end
+
+function lpdf.setdates(v)
+ local t = type(v)
if t == "number" or t == "string" then
- local d = converters.totime(dates)
- if d then
+ t = converters.totime(v)
+ if t then
included.date = true
included.id = "fake"
- report_info("forced date/time information %a will be used",lpdf.settime(d))
- settrailerid(false)
+ report_info("forced date/time information %a will be used",lpdf.settime(t))
+ lpdf.settrailerid(false)
return
end
- if t == "string" then
- dates = toboolean(dates)
- included.date = dates
- if dates ~= false then
- included.id = true
- else
- report_info("no date/time but fake id information will be added")
- settrailerid(true)
- included.id = "fake"
- end
- end
+ end
+ v = toboolean(v)
+ included.date = v
+ if v then
+ included.id = true
+ else
+ report_info("no date/time but fake id information will be added")
+ lpdf.settrailerid(true)
+ included.id = "fake"
+ -- maybe: lpdf.settime(231631200) -- 1975-05-05 % first entry of knuth about tex mentioned in DT
end
end
-function lpdf.settrailerid(v) trailerid = v end
-function lpdf.setdates (v) dates = v end
-
-lpdf.registerdocumentfinalizer(update,"trailer id and dates",1)
directives.register("backend.trailerid", lpdf.settrailerid)
directives.register("backend.date", lpdf.setdates)
@@ -318,7 +313,7 @@ local function flushxmpinfo()
commands.poprandomseed() -- hack
end
--- this will be enabled when we can inhibit compression for a stream at the lua end
+-- his will be enabled when we can inhibit compression for a stream at the lua end
lpdf.registerdocumentfinalizer(flushxmpinfo,1,"metadata")