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 Update on Monday, May 27th 2025

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
  • 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 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.

    ekkescornerE 1 Reply Last reply
    0
    • M Mike V.

      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.

      ekkescornerE Offline
      ekkescornerE Offline
      ekkescorner
      Qt Champions 2016
      wrote on 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
      1
      • ekkescornerE ekkescorner

        @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 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 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