Store book metadata and nb of pages in new settings

They may already be available (with other statistics stuff) under
the 'stats' key, but not if Statistics plugin is disabled. As this
plugin may be migrated to SQLite, readerui and readerfooter will now
set two new properties: doc_props (containing all and only the metadata
returned by document:getDocumentProps()) and doc_pages (updated
by readerfooter on any display or font change).

PDF document: returns additional PDF properties: Keywords
and Subject (as Description).
pull/3011/head
poire-z 7 years ago committed by Frans de Jonge
parent e6612ec728
commit 64f699ba36

@ -546,6 +546,7 @@ end
function ReaderFooter:onPageUpdate(pageno)
self.pageno = pageno
self.pages = self.view.document:getPageCount()
self.ui.doc_settings:saveSetting("doc_pages", self.pages) -- for Book information
self:updateFooterPage()
end

@ -342,6 +342,16 @@ function ReaderUI:init()
end
self.postInitCallback = nil
-- Now that document is loaded, store book metadata in settings
-- (so that filemanager can use it from sideCar file to display
-- Book information).
-- via pcall because picdocument:getProps() may fail
local ok, doc_props = pcall(self.document.getProps, self.document)
if not ok then
doc_props = {}
end
self.doc_settings:saveSetting("doc_props", doc_props)
-- After initialisation notify that document is loaded and rendered
-- CREngine only reports correct page count after rendering is done
-- Need the same event for PDF document

@ -174,6 +174,8 @@ function PdfDocument:getProps()
props.authors = props.author
props.series = ""
props.language = ""
props.keywords = props.keywords
props.description = props.subject
return props
end

Loading…
Cancel
Save