mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
#1710 FR: Add support of statistics plugin for pdf
This commit is contained in:
@@ -2,9 +2,9 @@ local Cache = require("cache")
|
||||
local CacheItem = require("cacheitem")
|
||||
local KoptOptions = require("ui/data/koptoptions")
|
||||
local Document = require("document/document")
|
||||
local Configurable = require("configurable")
|
||||
local DrawContext = require("ffi/drawcontext")
|
||||
local DEBUG = require("dbg")
|
||||
local util = require("util")
|
||||
|
||||
local PdfDocument = Document:new{
|
||||
_document = false,
|
||||
@@ -160,6 +160,22 @@ function PdfDocument:close()
|
||||
Document.close(self)
|
||||
end
|
||||
|
||||
function PdfDocument:getProps()
|
||||
local props = self._document:getMetadata()
|
||||
if props.title == "" then
|
||||
local startPos = util.lastIndexOf(self.file, "%/")
|
||||
if startPos > 0 then
|
||||
props.title = string.sub(self.file, startPos + 1, -5) --remove extension .pdf
|
||||
else
|
||||
props.title = string.sub(self.file, 0, -5)
|
||||
end
|
||||
end
|
||||
props.authors = props.author
|
||||
props.series = ""
|
||||
props.language = ""
|
||||
return props
|
||||
end
|
||||
|
||||
function PdfDocument:getLinkFromPosition(pageno, pos)
|
||||
return self.koptinterface:getLinkFromPosition(self, pageno, pos)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user