Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtPdf Android
Forum Updated to NodeBB v4.3 + New Features

QtPdf Android

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 4 Posters 4.8k 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.
  • AlexorleonA Offline
    AlexorleonA Offline
    Alexorleon
    wrote on last edited by
    #1

    Hi,
    i am trying to create a pdf viewer inside Qt. Before I used the poppler. But now there is a need to do this under android.

    I decided to try QtPdf
    http://blog.qt.io/blog/2017/01/30/new-qtpdf-qtlabs-module/

    Ubuntu 14.04 x64, Qt 5.9.3, gcc 4.8.4

    First under desktop. Install gcc 7.2. If this is not done there will be an error unrecognized command line option ‘-std=c++1z’
    Add to PATH Qt 5.9.3 gcc.

    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt update
    sudo apt install gcc-7
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7

    Now make works steadily. Example pdfviewer can be run through Qt Creator. Everything is going, pdf is opening. I added the code from the example to myself, the image of the page is created.

    Now under android 7.0. API level 24
    Add to PATH Qt android_armv7

    In Qt Creator I use jdk1.8.0_161.
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer

    make
    ...
    /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): перемещение 0 имеет недопустимый индекс символа 2
    /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crt1.o: In function _start': (.text+0x20): undefined reference to main'
    .obj/fpdfview.o: In function FPDF_InitLibraryWithConfig': /home/alexorleon/Development/Projects/pdf/android/qtpdf/src/lib/../3rdparty/pdfium/fpdfsdk/fpdfview.cpp:282: undefined reference to IJS_Runtime::Initialize(unsigned int, void*)'
    .obj/fpdfview.o: In function FPDF_DestroyLibrary': /home/alexorleon/Development/Projects/pdf/android/qtpdf/src/lib/../3rdparty/pdfium/fpdfsdk/fpdfview.cpp:295: undefined reference to IJS_Runtime::Destroy()'
    .obj/fsdk_mgr.o: In function CPDFDoc_Environment::GetJSRuntime()': /home/alexorleon/Development/Projects/pdf/android/qtpdf/src/lib/../3rdparty/pdfium/fpdfsdk/fsdk_mgr.cpp:216: undefined reference to IJS_Runtime::Create(CPDFDoc_Environment*)'
    collect2: error: ld returned 1 exit status
    make[2]: *** [qtpdfium] Ошибка 1
    make[2]: Выход из каталога /home/alexorleon/Development/Projects/pdf/android/qtpdf/src/lib' make[1]: *** [sub-lib-make_first-ordered] Ошибка 2 make[1]: Выход из каталога /home/alexorleon/Development/Projects/pdf/android/qtpdf/src'
    make: *** [sub-src-make_first] Ошибка 2

    IJS_Runtime. What is it?
    I can not find the cause of this error. Any ideas? Maybe I need to use VS on Windows?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Something's not clear: did you install Qt for Android development ?

      Also, how did you install Qt ?
      Furthermore, the error lines that you show looks like you are building using your desktop compiler which means that you are currently not building for Android at all.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      AlexorleonA 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi,

        Something's not clear: did you install Qt for Android development ?

        Also, how did you install Qt ?
        Furthermore, the error lines that you show looks like you are building using your desktop compiler which means that you are currently not building for Android at all.

        AlexorleonA Offline
        AlexorleonA Offline
        Alexorleon
        wrote on last edited by
        #3

        @SGaist, I used online installer. Qt 5.9.3 android_armv7

        jsulmJ 1 Reply Last reply
        0
        • AlexorleonA Alexorleon

          @SGaist, I used online installer. Qt 5.9.3 android_armv7

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Alexorleon Did you select the proper (Android) Kit in QtCreator? As @SGaist pointed out you're not building for Android.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • AlexorleonA Offline
            AlexorleonA Offline
            Alexorleon
            wrote on last edited by
            #5

            I used the command line. But after your words I decided to try it in Qt Creator.
            It seems the library has successfully assembled.

            But when i start, the program crashes on the device:
            E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libQt5Pdf.so" not found

            In the application, I use other libraries, without QtPdf everything works.

            I use the correct directory?

            INCLUDEPATH += "/home/alexorleon/Development/Projects/pdf/android/build-qpdf-Android_armeabi_v7a_GCC_4_9_Qt_Qt_5_9_3_armv7-Release/include/QtPdf"
            
            LIBS += -L/home/alexorleon/Development/Projects/pdf/android/build-qpdf-Android_armeabi_v7a_GCC_4_9_Qt_Qt_5_9_3_armv7-Release/lib -lQt5Pdf
            

            ├── build-qpdf-Android_armeabi_v7a_GCC_4_9_Qt_Qt_5_9_3_armv7-Release
            │ ├── android-build
            │ │ └── home
            │ │ └── alexorleon
            │ │ └── Qt
            │ │ └── 5.9.3
            │ │ └── android_armv7
            │ │ ├── include
            │ │ │ └── QtPdf
            │ │ ├── lib
            │ ├── bin
            │ ├── include
            │ │ └── QtPdf
            │ ├── lib
            │ │ ├── cmake
            │ │ │ └── Qt5Pdf
            │ │ └── pkgconfig
            ├── qtpdf
            │ ├── include
            │ │ └── QtPdf
            │ ├── lib

            Or need to specify
            ├── android-build
            │ │ └── home
            │ │ └── alexorleon
            │ │ └── Qt
            │ │ └── 5.9.3
            │ │ └── android_armv7
            │ │ ├── include
            │ │ │ └── QtPdf
            │ │ ├── lib

            I tried different options.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You have to first compile QtPdf for Android using your Qt for Android installation.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              AlexorleonA 1 Reply Last reply
              0
              • SGaistS SGaist

                You have to first compile QtPdf for Android using your Qt for Android installation.

                AlexorleonA Offline
                AlexorleonA Offline
                Alexorleon
                wrote on last edited by
                #7

                @SGaist I did this and specify this file.

                build-qpdf-Android_armeabi_v7a_GCC_4_9_Qt_Qt_5_9_3_armv7-Release

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  My bad, I misread your last post.

                  Did you bundle that library with your application also ?

                  Look at the Project panel. (more information here)

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #9

                    @Alexorleon I guess you may need to copy the library from your build directory into the proper location in your project using it.
                    Do you have already this folder structure in your project?

                    <PROJECT ROOT> / android / libs / armeabi-v7a /
                    

                    While building your application for Android, Qt Creator expects some components in particular locations.

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    1
                    • AlexorleonA Offline
                      AlexorleonA Offline
                      Alexorleon
                      wrote on last edited by
                      #10

                      Thanks for the help!
                      I created the AndroidManifest and added the ANDROID_EXTRA_LIBS line to the .pro file.

                      1 Reply Last reply
                      2
                      • Pablo J. RoginaP Offline
                        Pablo J. RoginaP Offline
                        Pablo J. Rogina
                        wrote on last edited by
                        #11

                        @Alexorleon please be aware that you can manage (edit) the manifest from within Qt Creator. And once your issue is solved, please don't forget to mark your post as such.

                        Upvote the answer(s) that helped you solve the issue
                        Use "Topic Tools" button to mark your post as Solved
                        Add screenshots via postimage.org
                        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                        1 Reply Last reply
                        2

                        • Login

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