Some fixes

This version managed to compile by Bachelor's thesis after I removed all
images, microtype and outline commands.
This commit is contained in:
Marcel Krüger 2020-06-06 04:09:56 +02:00
parent e59393de6f
commit c83b7ffc5e
3 changed files with 12 additions and 9 deletions

View File

@ -111,7 +111,8 @@ callback.register("stop_run", function()
nodestat[#nodestat + 1] = string.format("%d %s", c, whatsits[id])
end
texio.write_nl(" " .. table.concat(nodestat, ', '))
texio.write_nl(string.format("Output written on %s (%d pages, %d bytes).\n", pdfname, pages, size))
texio.write_nl(string.format("Output written on %s (%d pages, %d bytes).", pdfname, pages, size))
texio.write_nl(string.format("Transcript written on %s.\n", status.log_name))
end, "Finish PDF file")
token.luacmd("pdfvariable", function()
for n, t in pairs(pdf.variable_tokens) do

View File

@ -1,8 +1,7 @@
local min = math.min
local format = string.format
local concat = table.concat
local _ENV = {}
function write(pdf, tree, total, max)
local function write(pdf, tree, total, max)
tree = tree or pdf.pages
if #tree == 0 then
local id = pdf:getobj()
@ -20,7 +19,7 @@ function write(pdf, tree, total, max)
local id = tree[-i]
newtree[i+1] = id
if 0 == i % 6 and #tree > 6 then
local parentid = pdf:getid()
local parentid = pdf:getobj()
newtree[-(i//6)] = parentid
parent = format("/Parent %i 0 R", parentid)
end
@ -28,11 +27,11 @@ function write(pdf, tree, total, max)
remaining = remaining - max
end
if #parent > 0 then
return writetree(pdf, newtree, total, max*6)
return write(pdf, newtree, total, max*6)
end
return newtree[1]
end
function newpage(pdf)
local function newpage(pdf)
local pageid = pdf:getobj()
local pagenumber = #pdf.pages
pdf.pages[pagenumber+1] = pageid
@ -41,4 +40,7 @@ function newpage(pdf)
end
return pageid, pdf.pages[-(pagenumber//6)]
end
return _ENV
return {
write = write,
newpage = newpage,
}

View File

@ -55,7 +55,7 @@ local function indirect(pdf, num, content, isfile)
pdf.file:write'\nendobj\n'
return num
end
local function delayed(pdf, num, content, isfile)
local function delay(pdf, num, content, isfile)
if not num then num = pdf:getobj() end
if pdf[num] ~= assigned then
error[[Invalid object]]
@ -123,7 +123,7 @@ local pdfmeta = {
stream = stream,
newpage = pagetree.newpage,
writepages = pagetree.write,
delayed = delayed,
delayed = delay,
delayedstream = delayedstream,
reference = reference,
written = written,