summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/lpdf-xmp.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-07-14 21:22:10 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-07-14 21:22:10 +0200
commit23b495f46b4d2e9264d54095f43774ef47d3a656 (patch)
tree1b0131b93d92d4aa7e15b55c50ad1dfa3573a7e1 /tex/context/base/mkiv/lpdf-xmp.lua
parent6ae40572e7643edcc29f8d5b071221dd1e04bdf3 (diff)
downloadcontext-23b495f46b4d2e9264d54095f43774ef47d3a656.tar.gz
2017-07-14 19:41:00
Diffstat (limited to 'tex/context/base/mkiv/lpdf-xmp.lua')
-rw-r--r--tex/context/base/mkiv/lpdf-xmp.lua63
1 files changed, 34 insertions, 29 deletions
diff --git a/tex/context/base/mkiv/lpdf-xmp.lua b/tex/context/base/mkiv/lpdf-xmp.lua
index 26ced4aee..a0005eb8a 100644
--- a/tex/context/base/mkiv/lpdf-xmp.lua
+++ b/tex/context/base/mkiv/lpdf-xmp.lua
@@ -241,6 +241,8 @@ end
-- flushing
+local add_xmp_blob = true directives.register("backend.xmp",function(v) add_xmp_blob = v end)
+
local function flushxmpinfo()
commands.pushrandomseed()
commands.setrandomseed(os.time())
@@ -261,42 +263,45 @@ local function flushxmpinfo()
instanceid = "uuid:" .. os.uuid()
end
- pdfaddxmpinfo("DocumentID", documentid)
- pdfaddxmpinfo("InstanceID", instanceid)
- pdfaddxmpinfo("Producer", producer)
- pdfaddxmpinfo("CreatorTool", creator)
- pdfaddxmpinfo("CreateDate", time)
- pdfaddxmpinfo("ModifyDate", time)
- pdfaddxmpinfo("MetadataDate", time)
- pdfaddxmpinfo("PTEX.Fullbanner", fullbanner)
-
pdfaddtoinfo("Producer", producer)
pdfaddtoinfo("Creator", creator)
pdfaddtoinfo("CreationDate", time)
pdfaddtoinfo("ModDate", time)
-- pdfaddtoinfo("PTEX.Fullbanner", fullbanner) -- no checking done on existence
- local blob = xml.tostring(xml.first(xmp or valid_xmp(),"/x:xmpmeta"))
- local md = pdfdictionary {
- Subtype = pdfconstant("XML"),
- Type = pdfconstant("Metadata"),
- }
- if trace_xmp then
- report_xmp("data flushed, see log file")
- logs.pushtarget("logfile")
- report_xmp("start xmp blob")
- logs.newline()
- logs.writer(blob)
- logs.newline()
- report_xmp("stop xmp blob")
- logs.poptarget()
- end
- blob = format(xpacket,blob)
- if not verbose and pdf.getcompresslevel() > 0 then
- blob = gsub(blob,">%s+<","><")
+ if add_xmp_blob then
+
+ pdfaddxmpinfo("DocumentID", documentid)
+ pdfaddxmpinfo("InstanceID", instanceid)
+ pdfaddxmpinfo("Producer", producer)
+ pdfaddxmpinfo("CreatorTool", creator)
+ pdfaddxmpinfo("CreateDate", time)
+ pdfaddxmpinfo("ModifyDate", time)
+ pdfaddxmpinfo("MetadataDate", time)
+ pdfaddxmpinfo("PTEX.Fullbanner", fullbanner)
+
+ local blob = xml.tostring(xml.first(xmp or valid_xmp(),"/x:xmpmeta"))
+ local md = pdfdictionary {
+ Subtype = pdfconstant("XML"),
+ Type = pdfconstant("Metadata"),
+ }
+ if trace_xmp then
+ report_xmp("data flushed, see log file")
+ logs.pushtarget("logfile")
+ report_xmp("start xmp blob")
+ logs.newline()
+ logs.writer(blob)
+ logs.newline()
+ report_xmp("stop xmp blob")
+ logs.poptarget()
+ end
+ blob = format(xpacket,blob)
+ if not verbose and pdf.getcompresslevel() > 0 then
+ blob = gsub(blob,">%s+<","><")
+ end
+ local r = pdfflushstreamobject(blob,md,false) -- uncompressed
+ lpdf.addtocatalog("Metadata",pdfreference(r))
end
- local r = pdfflushstreamobject(blob,md,false) -- uncompressed
- lpdf.addtocatalog("Metadata",pdfreference(r))
commands.poprandomseed() -- hack
end