[webkit-qt] Crash with pdf.js (Technology preview 5)
Thomas Rusche
thomas.rusche at gmail.com
Sun Apr 30 00:55:54 PDT 2017
Hello!
Recently I downloaded the preview version 5 and tried to view pdf files
with Mozilla's pdf.js. I am using Qt5.8 on Windows 8.1 64bit with MinGW.
The application crashes immediately, saying there was an error in this
Webkit lib. I cannot find more details because the MinGW debug build is not
supported right now.
But perhaps you can retry it.
Just download pdf.js from here: https://github.com/mozilla/pdf.js/releases
and integrate it into a Qt-resource-file under the prefix "/pdfjs".
Here is the source code:
*pdfjs.h:*
#ifndef PDFJS_H
#define PDFJS_H
#include <QWidget>
#include <QtWebKitWidgets/QWebView>
class PdfJs : public QWidget
{
Q_OBJECT
QWebView *webview_ = nullptr;
public:
PdfJs(QWidget *parent = 0);
~PdfJs();
};
#endif // PDFJS_H
*pdfjs.cpp:*
#include "pdfjs.h"
#include <QVBoxLayout>
#include <QWebInspector>
#include <QWebSettings>
PdfJs::PdfJs(QWidget *parent)
: QWidget(parent)
{
this->setLayout( new QVBoxLayout );
this->layout()->setContentsMargins(0,0,0,0);
webview_ = new QWebView(this);
webview_->setUrl( QUrl("qrc:/pdfjs/web/viewer.html") );
// Try to find crash hints with the WebInspector (did not work,
app crashes too early)
webview_->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled,
true);
QWebInspector *inspector = new QWebInspector();
inspector->setPage(webview_->page());
inspector->setVisible(true);
this->layout()->addWidget( webview_ );
}
PdfJs::~PdfJs()
{
}
Greetings
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20170430/86a18a5a/attachment.html>
More information about the webkit-qt
mailing list