mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
GwR add PDF pagecount to annotations
This commit is contained in:
parent
952deee784
commit
197923c54b
@ -448,12 +448,11 @@ class Bookmark():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
elif self.bookmark_extension == 'pdr':
|
elif self.bookmark_extension == 'pdr':
|
||||||
# Book length not yet implemented for PDF files
|
from calibre import plugins
|
||||||
# After 0.6.45:
|
try:
|
||||||
# from calibre import plugins
|
self.book_length = plugins['pdfreflow'][0].get_numpages(open(book_fs).read())
|
||||||
# self.book_length = plugins['pdfreflow'][0].get_numpages(open(book_fs).read())
|
except:
|
||||||
|
pass
|
||||||
self.book_length = 0
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "unsupported bookmark_extension: %s" % self.bookmark_extension
|
print "unsupported bookmark_extension: %s" % self.bookmark_extension
|
||||||
|
@ -1013,9 +1013,10 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
spanTag = Tag(ka_soup, 'span')
|
spanTag = Tag(ka_soup, 'span')
|
||||||
spanTag['style'] = 'font-weight:bold'
|
spanTag['style'] = 'font-weight:bold'
|
||||||
if bookmark.book_format == 'pdf':
|
if bookmark.book_format == 'pdf':
|
||||||
spanTag.insert(0,NavigableString("%s<br />Last Page Read: %d" % \
|
spanTag.insert(0,NavigableString("%s<br />Last Page Read: %d (%d%%)" % \
|
||||||
(strftime(u'%x', timestamp.timetuple()),
|
(strftime(u'%x', timestamp.timetuple()),
|
||||||
last_read_location)))
|
last_read_location,
|
||||||
|
percent_read)))
|
||||||
else:
|
else:
|
||||||
spanTag.insert(0,NavigableString("%s<br />Last Page Read: Location %d (%d%%)" % \
|
spanTag.insert(0,NavigableString("%s<br />Last Page Read: Location %d (%d%%)" % \
|
||||||
(strftime(u'%x', timestamp.timetuple()),
|
(strftime(u'%x', timestamp.timetuple()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user