diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webpage.py index a8683aaeb..7197aa889 100644 --- a/qutebrowser/browser/webpage.py +++ b/qutebrowser/browser/webpage.py @@ -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() diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 801278e27..fbe5c2319 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -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 )),