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. can't compile QtPdfium
Forum Updated to NodeBB v4.3 + New Features

can't compile QtPdfium

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 3.2k Views 3 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.
  • AmrCoderA Offline
    AmrCoderA Offline
    AmrCoder
    wrote on last edited by
    #3

    I Updated the question

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Hi
      From
      https://pdfium.googlesource.com/pdfium/+/master/README.md
      The lib QPdfium uses.

      it says
      Windows development
      PDFium uses the same build tool as Chromium:

      so that makes we wonder if its even possible to build with mingw ?

      1 Reply Last reply
      0
      • AmrCoderA Offline
        AmrCoderA Offline
        AmrCoder
        wrote on last edited by
        #5

        @mrjjI don't know but even if I built using MSVC I got more errors, all I want is a good library to read data from PDF file I can use with my Qt application I tested QPoppler but same problem I can't compile it, gives me a lot of errors and it needs a lot of dependencies, when I used it, it was old precompiled library I download it, so I can't update to the last Poppler release with the new futures because there are no precompiled libraries to download I must compile it.

        mrjjM 1 Reply Last reply
        0
        • AmrCoderA AmrCoder

          @mrjjI don't know but even if I built using MSVC I got more errors, all I want is a good library to read data from PDF file I can use with my Qt application I tested QPoppler but same problem I can't compile it, gives me a lot of errors and it needs a lot of dependencies, when I used it, it was old precompiled library I download it, so I can't update to the last Poppler release with the new futures because there are no precompiled libraries to download I must compile it.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #6

          @AmrCoder
          Hi
          When i read what QtPdfium does, it sounds like it can display pdf files but im not sure you can extract text with it.
          If the goal is only to extract text from pdf, you could cheat and just use QProcess to call a tool to do it for you.
          https://en.wikipedia.org/wiki/Pdftotext

          1 Reply Last reply
          3
          • AmrCoderA Offline
            AmrCoderA Offline
            AmrCoder
            wrote on last edited by
            #7

            This example on the GitHub

            And for extracting text:
            
            #include <QtPdfium/QPdfium>
            
            QPdfium pdf("mypdf.pdf");
            QPdfiumPage page =  pdf.page(0);
            QString pageText = page.text();
            

            yes i see but i want to do it throw a code in my application if possible.

            mrjjM 1 Reply Last reply
            1
            • AmrCoderA AmrCoder

              This example on the GitHub

              And for extracting text:
              
              #include <QtPdfium/QPdfium>
              
              QPdfium pdf("mypdf.pdf");
              QPdfiumPage page =  pdf.page(0);
              QString pageText = page.text();
              

              yes i see but i want to do it throw a code in my application if possible.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @AmrCoder
              Ah good. I miss that part.
              Well should work fine then.
              Ok, i understand you want it in-app.
              It was just case it was option to use external tool :)

              1 Reply Last reply
              1
              • P Offline
                P Offline
                Pietrko
                wrote on last edited by Pietrko
                #9

                Any progress on this?

                I have the same error. The code that bugs requires CFX_WindowsDevice to be defined.
                This piece of code is conditionally compiled when _WIN_32 define is set.
                This is not the case by default, the "platform" is set to QT whatever it means.

                Someone didn't make a proper job with those defines.
                @AmrCoder If you somehow managed to solve this, please share the solution. The code works on linux.

                1 Reply Last reply
                1
                • AmrCoderA Offline
                  AmrCoderA Offline
                  AmrCoder
                  wrote on last edited by
                  #10

                  @Pietrko, to be honest, I gave up after I got no answer but iam still actually interesting to make it works, so what should I add to make it work on windows please if you can post it step by step, I understand it should be cross-platform but for now I want to make it work on windows
                  Thank you.

                  1 Reply Last reply
                  0
                  • AmrCoderA Offline
                    AmrCoderA Offline
                    AmrCoder
                    wrote on last edited by
                    #11

                    I tried to download the Pdfium from Google using this command

                    git clone https://pdfium.googlesource.com/pdfium
                    

                    it downloads about 129 MB file not as the Pdfium that comes with the QPdfium which is 29 MB, then i replace it and compile I got this error

                    :-1: error: No rule to make target 'D:/cook/qtpdfium-master/src/3rdparty/pdfium/fpdfsdk/cba_annotiterator.cpp', needed by '.obj/debug/cba_annotiterator.o'.  Stop.
                    

                    I found many version of Pdfium each one has some files missing and give me this error each time with different file when I search on this file on google I got a GitHub Link which contains a pdfium source code which contains this file, when I download this one it missing other files, so is there anyway to make it work on windows I don't need cross-compiling Now.

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      Pietrko
                      wrote on last edited by Pietrko
                      #12

                      I managed to get it work.
                      You have to either patch like four files from pdfium or use "espen/compile-on-mingw" branch of this fork of qpdfium:

                      Remember to use "espen/compile-on-mingw" branch on qtpdifum and this branch "https://github.com/snowpong/pdfium/tree/g_38c2705c
                      on snowpong pdfium repo.

                      BTW: even this guy made a mistake and put "qt" branch in .gitmodules insgtead of g_38c2705c
                      Fix that.

                      I hope you know how to update submodules of git repo.
                      GL, it works

                      1 Reply Last reply
                      1

                      • Login

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