pdfjs: Use abosolute URLs

That allows us to use the "original" page URL when displaying with
pdf.js, which means yanking the URL etc works as intended.
This commit is contained in:
Daniel Schadt 2015-11-11 10:19:36 +01:00
parent 0ee13392e1
commit 5e0090d5b8
4 changed files with 13 additions and 13 deletions

View File

@ -309,8 +309,8 @@ class BrowserPage(QWebPage):
elif mimetype in {'application/pdf', 'application/x-pdf'}: elif mimetype in {'application/pdf', 'application/x-pdf'}:
# Use pdf.js to display the page # Use pdf.js to display the page
html_page = _generate_pdfjs(reply) html_page = _generate_pdfjs(reply)
#url = reply.url() url = reply.url()
url = QUrl('qute://pdfjs/web/viewer.js') #url = QUrl('qute://pdfjs/web/viewer.js')
self.mainFrame().setContent(html_page.encode('utf-8'), self.mainFrame().setContent(html_page.encode('utf-8'),
'text/html', url) 'text/html', url)
reply.deleteLater() reply.deleteLater()

View File

@ -1,4 +1,4 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright 2012 Mozilla Foundation Copyright 2012 Mozilla Foundation
@ -29,21 +29,21 @@ See https://github.com/adobe-type-tools/cmap-resources
<title>PDF.js viewer</title> <title>PDF.js viewer</title>
<link rel="stylesheet" href="viewer.css"/> <link rel="stylesheet" href="qute://pdfjs/web/viewer.css"/>
<script src="compatibility.js"></script> <script src="qute://pdfjs/web/compatibility.js"></script>
<!-- This snippet is used in production (included from viewer.html) --> <!-- This snippet is used in production (included from viewer.html) -->
<link rel="resource" type="application/l10n" href="locale/locale.properties"/> <link rel="resource" type="application/l10n" href="qute://pdfjs/web/locale/locale.properties"/>
<script src="l10n.js"></script> <script src="qute://pdfjs/web/l10n.js"></script>
<script src="../build/pdf.js"></script> <script src="qute://pdfjs/build/pdf.js"></script>
<script src="debugger.js"></script> <script src="qute://pdfjs/web/debugger.js"></script>
<script src="viewer.js"></script> <script src="qute://pdfjs/web/viewer.js"></script>
</head> </head>

View File

@ -36,9 +36,9 @@ var SCALE_SELECT_PADDING = 22;
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading'; var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
PDFJS.imageResourcesPath = './images/'; PDFJS.imageResourcesPath = 'qute://pdfjs/web/images/';
PDFJS.workerSrc = '../build/pdf.worker.js'; PDFJS.workerSrc = 'qute://pdfjs/build/pdf.worker.js';
PDFJS.cMapUrl = '../web/cmaps/'; PDFJS.cMapUrl = 'qute://pdfjs/web/cmaps/';
PDFJS.cMapPacked = true; PDFJS.cMapPacked = true;
var mozL10n = document.mozL10n || document.webL10n; var mozL10n = document.mozL10n || document.webL10n;