Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Open a local PDF file from QT app for iOS
Forum Updated to NodeBB v4.3 + New Features

Open a local PDF file from QT app for iOS

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 3 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike V.
    wrote on 19 Jul 2018, 17:39 last edited by
    #1

    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.

    E 1 Reply Last reply 20 Jul 2018, 14:43
    0
    • M Mike V.
      19 Jul 2018, 17:39

      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.

      E Offline
      E Offline
      ekkescorner
      Qt Champions 2016
      wrote on 20 Jul 2018, 14:43 last edited by
      #2

      @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."));
      }
      

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
      5.15 --> 6.8 https://t1p.de/ekkeChecklist
      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

      M 1 Reply Last reply 23 Jul 2018, 15:59
      1
      • E ekkescorner
        20 Jul 2018, 14:43

        @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."));
        }
        
        M Offline
        M Offline
        Mike V.
        wrote on 23 Jul 2018, 15:59 last edited by
        #3

        @ekkescorner

        Thank you, Ekke. I will take a look at your example app. Much appreciated.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sidrvg
          wrote on 23 Jul 2019, 20:10 last edited by
          #4

          @Mike-V AppStudio now supports DocumentDialog which lets you open pdfs on iOS.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved