mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
34 lines
784 B
Lua
34 lines
784 B
Lua
require "unireader"
|
|
|
|
DJVUReader = UniReader:new{}
|
|
|
|
-- open a DJVU file and its settings store
|
|
-- DJVU does not support password yet
|
|
function DJVUReader:open(filename)
|
|
local ok
|
|
ok, self.doc = pcall(djvu.openDocument, filename, self.cache_document_size)
|
|
if not ok then
|
|
return ok, self.doc -- this will be the error message instead
|
|
end
|
|
return ok
|
|
end
|
|
|
|
function DJVUReader:init()
|
|
self:addAllCommands()
|
|
self:adjustDjvuReaderCommand()
|
|
end
|
|
|
|
function DJVUReader:adjustDjvuReaderCommand()
|
|
self.commands:del(KEY_J, MOD_SHIFT, "J")
|
|
self.commands:del(KEY_K, MOD_SHIFT, "K")
|
|
end
|
|
|
|
|
|
----------------------------------------------------
|
|
-- highlight support
|
|
----------------------------------------------------
|
|
function DJVUReader:getText(pageno)
|
|
return self.doc:getPageText(pageno)
|
|
end
|
|
|