Some PDF toks variables
This commit is contained in:
parent
acc0ad0559
commit
f4f829dbac
@ -47,7 +47,7 @@ token.luacmd("shipout", function()
|
|||||||
local out, resources, annots = writer(pfile, list, fontdirs, usedglyphs, colorstacks)
|
local out, resources, annots = writer(pfile, list, fontdirs, usedglyphs, colorstacks)
|
||||||
cur_page = nil
|
cur_page = nil
|
||||||
local content = pfile:stream(nil, '', out)
|
local content = pfile:stream(nil, '', out)
|
||||||
pfile:indirect(page, string.format([[<</Type/Page/Parent %i 0 R/Contents %i 0 R/MediaBox[0 %i %i %i]/Resources<<%s>>%s>>]], parent, content, -math.ceil(list.depth/65781.76), math.ceil(list.width/65781.76), math.ceil(list.height/65781.76), resources, annots))
|
pfile:indirect(page, string.format([[<</Type/Page/Parent %i 0 R/Contents %i 0 R/MediaBox[0 %i %i %i]/Resources<<%s%s>>%s%s>>]], parent, content, -math.ceil(list.depth/65781.76), math.ceil(list.width/65781.76), math.ceil(list.height/65781.76), resources, pdfvariable.pageresources, annots, pdfvariable.pageattr))
|
||||||
node.flush_list(list)
|
node.flush_list(list)
|
||||||
token.put_next(token.create'immediateassignment', token.create'global', token.create'deadcycles', token.create(0x30), token.create'relax')
|
token.put_next(token.create'immediateassignment', token.create'global', token.create'deadcycles', token.create(0x30), token.create'relax')
|
||||||
token.scan_token()
|
token.scan_token()
|
||||||
|
@ -149,9 +149,10 @@ pdf_variable(count_code, token.scan_int, 'forcepagebox', 0, true) -- Considered
|
|||||||
pdf_variable(count_code, token.scan_int, 'imageresolution', 72, true) -- TODO Also 0 should be the same as 72 ?!?!?!?
|
pdf_variable(count_code, token.scan_int, 'imageresolution', 72, true) -- TODO Also 0 should be the same as 72 ?!?!?!?
|
||||||
-- The following two relate to pk fonts which we don't support, so they are ignored on a different level
|
-- The following two relate to pk fonts which we don't support, so they are ignored on a different level
|
||||||
pdf_variable(count_code, token.scan_int, 'pkresolution', 72)
|
pdf_variable(count_code, token.scan_int, 'pkresolution', 72)
|
||||||
-- pdf_variable(toks_code, token.scan_string, 'pkmode', '')
|
pdf_toks('pkmode', '')
|
||||||
|
|
||||||
|
|
||||||
|
pdf_toks('pageattr', '')
|
||||||
|
pdf_toks('pagesattr', '')
|
||||||
pdf_toks('pageresources', '')
|
pdf_toks('pageresources', '')
|
||||||
|
|
||||||
function tex.getbodydir() return tex.bodydirection end
|
function tex.getbodydir() return tex.bodydirection end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
local min = math.min
|
local min = math.min
|
||||||
local format = string.format
|
local format = string.format
|
||||||
local concat = table.concat
|
local concat = table.concat
|
||||||
|
local pdfvariable = pdf.variable
|
||||||
local function write(pdf, tree, total, max)
|
local function write(pdf, tree, total, max)
|
||||||
tree = tree or pdf.pages
|
tree = tree or pdf.pages
|
||||||
if #tree == 0 then
|
if #tree == 0 then
|
||||||
@ -22,11 +23,13 @@ local function write(pdf, tree, total, max)
|
|||||||
local parentid = pdf:getobj()
|
local parentid = pdf:getobj()
|
||||||
newtree[-(i//6)] = parentid
|
newtree[-(i//6)] = parentid
|
||||||
parent = format("/Parent %i 0 R", parentid)
|
parent = format("/Parent %i 0 R", parentid)
|
||||||
|
elseif #tree <= 6 then
|
||||||
|
parent = pdfvariable.pagesattr
|
||||||
end
|
end
|
||||||
pdf:indirect(id, format('<</Type/Pages%s/Kids[%s 0 R]/Count %i>>', parent, concat(tree, ' 0 R ', 6*i+1, min(#tree, 6*i+6)), min(remaining, max)))
|
pdf:indirect(id, format('<</Type/Pages%s/Kids[%s 0 R]/Count %i>>', parent, concat(tree, ' 0 R ', 6*i+1, min(#tree, 6*i+6)), min(remaining, max)))
|
||||||
remaining = remaining - max
|
remaining = remaining - max
|
||||||
end
|
end
|
||||||
if #parent > 0 then
|
if newtree[0] then
|
||||||
return write(pdf, newtree, total, max*6)
|
return write(pdf, newtree, total, max*6)
|
||||||
end
|
end
|
||||||
return newtree[1]
|
return newtree[1]
|
||||||
|
Loading…
Reference in New Issue
Block a user