Opening PDF in QML (or running an external application)
-
[quote author="sierdzio" date="1404586826"]You have 2 systems that are built into Qt and guaranteed to work on supported platforms:
- in C++, there is "QDesktopServices":http://qt-project.org/doc/qt-5/qdesktopservices.html#openUrl
- in QML, there is "Qt.openUrlExternally":http://qt-project.org/doc/qt-5/qml-qtqml-qt.html#openUrlExternally-method
You can feed those methods basically anything, and it will be opened by the native app for a given file, or the web browser.[/quote]
Thank you, openUrlExternally() is a life saver (though I can't seem to make it work either, but nothing I would not be able to handle myself :) )
Still, I'm curious about the 3rd question. Basicly, what I want, is a ebook reader with images and interactivity. Openning a file in an external program is the most easy and obvious one, but not elegant, and I might have problems with application owners. Since it is a project that is thought out and made entirely by me for schools and educational purposes, I have freedom to chose which format will be used for books, therefore I'm looking towards HTML (or XML) but I can't think of a way to work with those on embeded linux (that doesn't mean that that is imposible). I would be happy if someone would give me a hint on what shoud i do in this situation
-
[quote author="aabc" date="1404632512"]Hi Darkmalex,
I suggest you to use the Poppler lib to open and view PDF documents. [/quote]Thanks. Might give it another try, because my previous attempts to work with poppler were not that good, but it still seems like the only option I have left to embed books into my app.
-
You have 2 systems that are built into Qt and guaranteed to work on supported platforms:
- in C++, there is "QDesktopServices":http://qt-project.org/doc/qt-5/qdesktopservices.html#openUrl
- in QML, there is "Qt.openUrlExternally":http://qt-project.org/doc/qt-5/qml-qtqml-qt.html#openUrlExternally-method
You can feed those methods basically anything, and it will be opened by the native app for a given file, or the web browser.
@sierdzio
When i use Qt.openUrlExternally() it gives below message.The specified location is not supported
-
@sierdzio
When i use Qt.openUrlExternally() it gives below message.The specified location is not supported
@Shubham-Gupta said in Opening PDF in QML (or running an external application):
@sierdzio
When i use Qt.openUrlExternally() it gives below message.The specified location is not supported
What path / URL are you opening? On which Operating System? With which Qt version?
-
Operating system: Linux
Path: My local machine -
OK, but what path, specifically? Please paste the code.
Note: that methods expects an URL, so a path should have
file://prefix. -
Like
Qt.openUrlExternally("file://Provisional Degree Certificate")
I used this.
and gave below error.gio: file:./: Operation not supported
-
Like
Qt.openUrlExternally("file://Provisional Degree Certificate")
I used this.
and gave below error.gio: file:./: Operation not supported
@Shubham-Gupta said in Opening PDF in QML (or running an external application):
file://Provisional Degree Certificate
Try to use absolute path (I guess it is somewhere in your home directory?)
Also: is this a file name? There is no file extension, not sure how the system should decide how to open it? -
Hi,
Also, you should use QUrl::fromLocalFile. It will build the proper URL.