Open a local PDF file from QT app for iOS
-
I am using AppStudio from ESRI which run QT Creator 4.3.1 base on QT 5.9.1 (MSVC 2015, 32 bit) using QML.
Qt.openUrlExternally(app.folder.folder("data").path + "/" + "test.pdf");
This works on Windows and Android as the default pdf reader opened it. However, in iOS, nothing happens and I checked the path and the file exists. This question was asked about 2 years ago and SGaist mentioned it has not been implemented yet for iOS and I heard Apple has really added more security that could possibly prevent the app from doing this. Any idea on how to open pdf in iOS.
Thank you.
-
I am using AppStudio from ESRI which run QT Creator 4.3.1 base on QT 5.9.1 (MSVC 2015, 32 bit) using QML.
Qt.openUrlExternally(app.folder.folder("data").path + "/" + "test.pdf");
This works on Windows and Android as the default pdf reader opened it. However, in iOS, nothing happens and I checked the path and the file exists. This question was asked about 2 years ago and SGaist mentioned it has not been implemented yet for iOS and I heard Apple has really added more security that could possibly prevent the app from doing this. Any idea on how to open pdf in iOS.
Thank you.
@Mike-V. best way is to use UIDocumentInteractionController. see my example app
the example app always uses UIDocumentInteractionController to present a preview
will extend the example soon to open the OpenIn Menu instead of Preview - also possible from UIDocumentInteractionController:[documentInteractionController retain]; if(![documentInteractionController presentOpenInMenuFromRect:CGRectZero inView: qtUIViewController.view animated: true]) { emit shareError(-1, tr("No App found to open this Type.")); }
-
@Mike-V. best way is to use UIDocumentInteractionController. see my example app
the example app always uses UIDocumentInteractionController to present a preview
will extend the example soon to open the OpenIn Menu instead of Preview - also possible from UIDocumentInteractionController:[documentInteractionController retain]; if(![documentInteractionController presentOpenInMenuFromRect:CGRectZero inView: qtUIViewController.view animated: true]) { emit shareError(-1, tr("No App found to open this Type.")); }
Thank you, Ekke. I will take a look at your example app. Much appreciated.