How to go about opening a PDF in iOS where the PDF is part of the App
-
I have an application that must open up its manual. The manual is a PDF file.
I have the file as a resource of the application. And the application will run on an iPad. Obviously my app is written using Qt. I use QML for the UI stuff.
I would like write some code that would launch the default application for PDF reading. I would guess Safari would do the job just fine.
Here is my issue. Since the file is part of the App it means I have to copy it somewhere that is both accessible as a Write location for my app and as a read location for the Reader. And as far as I undestand it, this is not possible due to security restrictions on iPad.
So is there a way in which I can get what I want?
Basically I need the user to click a link in my app and then display a PDF file that is part of the App. Anyway to accomplish this would be viable.
-
There's the built-in PDF module in Qt: https://doc.qt.io/qt-6/qtpdf-index.html It should work directly with QRC data, so no need to worry about sharing it with Safari.
If licensing is OK for you and if it works on iOS - I haven't checked myself.
-
Unfortunately it works, just not on iOS. I have tried this. I created an example compiled and run for MacOS. But when I tried it on iOS the application crashed showing me some strange memory error inside one of the qt sources. I've actually raised a support ticket with Qt (we have the paid license) and their first answer was read the documentation, like they didn't even read my ticket. So I'm looking for alternatives.
-
have you tried QDesktopServices (https://doc.qt.io/qt-6/qdesktopservices.html) to open the pdf inside your app with Pdf app outside ?