Add setting value to enable/disable pdf.js

This commit is contained in:
Daniel Schadt 2015-11-11 11:02:12 +01:00
parent 1882fb6006
commit 8b141037ef
2 changed files with 7 additions and 1 deletions

View File

@ -306,7 +306,8 @@ class BrowserPage(QWebPage):
else:
reply.finished.connect(functools.partial(
self.display_content, reply, 'image/jpeg'))
elif mimetype in {'application/pdf', 'application/x-pdf'}:
elif (mimetype in {'application/pdf', 'application/x-pdf'} and
config.get('content', 'enable-pdfjs')):
# Use pdf.js to display the page
html_page = _generate_pdfjs(reply)
url = reply.url()

View File

@ -841,6 +841,11 @@ def data(readonly=False):
"required to exactly match the requested domain.\n\n"
"Local domains are always exempt from hostblocking."),
('enable-pdfjs', SettingValue(typ.Bool(), 'true'),
"Enable pdf.js to view PDF files in the browser.\n\n"
"Note that the files can still be downloaded by clicking"
" the download button in the pdf.js viewer."),
readonly=readonly
)),