Get PDF.js to work
We need to use the /web/viewer.html path so relative references are correct.
This commit is contained in:
parent
7206dde19c
commit
bbcb87e434
@ -214,7 +214,7 @@ def should_use_pdfjs(mimetype):
|
||||
|
||||
def get_main_url(filename):
|
||||
"""Get the URL to be opened to view a local PDF."""
|
||||
url = QUrl('qute://pdfjs/')
|
||||
url = QUrl('qute://pdfjs/web/viewer.html')
|
||||
|
||||
file_url = QUrl('qute://pdfjs/file')
|
||||
file_url_query = QUrlQuery()
|
||||
|
@ -533,7 +533,7 @@ def qute_pdfjs(url):
|
||||
mimetype = 'application/octet-stream'
|
||||
return mimetype, data
|
||||
|
||||
if url.path() == '/':
|
||||
if url.path() == '/web/viewer.html':
|
||||
filepath = QUrlQuery(url).queryItemValue("file")
|
||||
data = pdfjs.generate_pdfjs_page(QUrl.fromLocalFile(filepath))
|
||||
return 'text/html', data
|
||||
|
@ -17,7 +17,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import textwrap
|
||||
|
||||
import pytest
|
||||
from PyQt5.QtCore import QUrl
|
||||
|
||||
from qutebrowser.browser import pdfjs
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user