Including (and viewing) PDF file in Qt Help Collection
-
This is something I find conflicting information on when I search the 'net:
If I include a PDF file in a Qt Help Collection, is Qt Assistant supposed to be able to let me view it (possibly with the help of an external application)?
I've actually packaged a couple of PDFs and one of my collections, and seem to remember having been able to view them in the past, but I could be wrong... What I do know is that currently, when I press links to the files in question in assistant, nothing whatsoever will happen - there is not even an error message on the console. This is using Qt Assistant 4.7.3 under CentOS Linux.
Any help would be appreciated.
TIA,
- Toralf
-
Qt has no builtin means of viewing PDFs. There are two options:
First:
Include a pdf viewer like "poppler":http://poppler.freedesktop.org/ - be aware of license restrictions that can arise of the GPL.Second:
Use a [[Doc:QWebView]] to display the help contents, connect a slot to signal "linkClicked() ":http://doc.qt.nokia.com/4.7/qwebview.html#linkClicked of that webview and in the slot, check whether the URL ends with .pdf and call "QDesktopServices::openUrl() ":http://doc.qt.nokia.com/4.7/qdesktopservices.html#openUrl on that URL. This will open the standard application associated with that file type. This is the way I do it (not with help contents, but "regular" html). -
I didn't ask for a built-in means of viewing PDF as such. I wanted to know if Qt Assistant can open links to PDF files, by opening a helper application if necessary.
-
"https://bugreports.qt.nokia.com/browse/QTBUG-2514":https://bugreports.qt.nokia.com/browse/QTBUG-2514
bq. We do not support showing pdf files inside Assistant, we basically dump them out of the compressed help file and use the corresponding desktop application to show it.
[quote author="toralf" date="1316443967"]I've actually packaged a couple of PDFs and one of my collections, and seem to remember having been able to view them in the past, but I could be wrong...[/quote]
Looks like you aren't. If it has worked for you but it doesn't anymore you should file a bug-report.
-
[quote author="Lukas Geyer" date="1316504075"]"https://bugreports.qt.nokia.com/browse/QTBUG-2514":https://bugreports.qt.nokia.com/browse/QTBUG-2514
bq. We do not support showing pdf files inside Assistant, we basically dump them out of the compressed help file and use the corresponding desktop application to show it.
[/quote]Ah, yes, that's what I thought. I was a bit confused by posts like this, though:
http://stackoverflow.com/questions/6947172/how-to-link-to-a-pdf-file-in-qt-assistant[quote author="Lukas Geyer" date="1316504075"]
[quote author="toralf" date="1316443967"]I've actually packaged a couple of PDFs and one of my collections, and seem to remember having been able to view them in the past, but I could be wrong...[/quote]Looks like you aren't. If it has worked for you but it doesn't anymore you should file a bug-report.[/quote]
https://bugreports.qt.nokia.com/browse/QTBUG-21559 ;-)I've found that as a workaround, PDFs may be packaged with a non-standard filename suffix - I've used ".pdf_". Qt Assistant will then fail to understand that the files have PDF format and will thus not assume they may be viewed internally. The desktop support routine that is called as a consequence, to open the files with an external application, will on the other hand still recognise them (based on content, I suppose) - at least on my setup.