diff --git a/pdf.lua b/pdf.lua index d5ae598..dde733c 100644 --- a/pdf.lua +++ b/pdf.lua @@ -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 @@ -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) @@ -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") @@ -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 --