Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pdf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PDF.new = function()

local add = function(obj)
table.insert(object, obj)
obj.number = table.getn(object)
obj.number = #object
return obj
end

Expand Down Expand Up @@ -111,7 +111,7 @@ PDF.new = function()

xref_table_offset = fh:seek()
fh:write("xref\n")
fh:write(string.format("%d %d\n", 1, table.getn(object)))
fh:write(string.format("%d %d\n", 1, #object))
for i, obj in ipairs(object) do
fh:write(
string.format("%010d %05d n \n", obj.offset, 0)
Expand All @@ -122,7 +122,7 @@ PDF.new = function()
local write_trailer = function(fh)
fh:write("trailer\n")
fh:write("<<\n")
fh:write(string.format("/Size %d\n", table.getn(object)))
fh:write(string.format("/Size %d\n", #object))
fh:write("/Root " .. get_ref(catalog_obj) .. "\n")
fh:write(">>\n")
fh:write("startxref\n")
Expand Down Expand Up @@ -167,7 +167,7 @@ PDF.new = function()
end

table.insert(used_font, font_obj)
return "/F" .. table.getn(used_font)
return "/F" .. #used_font
end

--
Expand Down