Better handle duplicate destinations
This commit is contained in:
parent
f20e543cce
commit
279a85109d
@ -142,8 +142,12 @@ local function do_dest(prop, p, n, x, y)
|
||||
elseif dest_type == "fitbv" then
|
||||
data = string.format("[%i 0 R/FitBV %.5f]", cur_page, sp2bp(x))
|
||||
end
|
||||
if pfile:written(dests[id]) then
|
||||
texio.write_nl(string.format("Duplicate destination %q", id))
|
||||
else
|
||||
dests[id] = pfile:indirect(dests[id], data)
|
||||
end
|
||||
end
|
||||
local function do_refobj(prop, p, n, x, y)
|
||||
pfile:reference(prop.obj)
|
||||
end
|
||||
|
@ -7,6 +7,13 @@ local pairs = pairs
|
||||
local setmetatable = setmetatable
|
||||
local assigned = {}
|
||||
local delayed = {}
|
||||
-- slightly tricky interface: No/nil return means that the objects content
|
||||
-- isn't known yet, while false indicates a delayed object.
|
||||
local function written(pdf, num)
|
||||
num = pdf[num]
|
||||
if not num or num == assigned then return end
|
||||
return num ~= delayed
|
||||
end
|
||||
local function stream(pdf, num, dict, content, isfile)
|
||||
if not num then num = pdf:getobj() end
|
||||
if pdf[num] ~= assigned then
|
||||
@ -117,6 +124,7 @@ local pdfmeta = {
|
||||
delayed = delayed,
|
||||
delayedstream = delayedstream,
|
||||
reference = reference,
|
||||
written = written,
|
||||
}
|
||||
pdfmeta.__index = pdfmeta
|
||||
local function open(filename)
|
||||
|
Loading…
Reference in New Issue
Block a user