1. 17 Jul, 2021 2 commits
  2. 15 Jul, 2021 1 commit
  3. 14 Jul, 2021 1 commit
    • Oliver Sander's avatar
      Make getPdfVersion return a dedicated version object · 13c95f25
      Oliver Sander authored
      That's a bit more modern than the old way where pointers to two
      integers had to be passed to the method.
      
      With the new method you can write
      
        auto pdfVersion = doc->getPdfVersion();
        // access numbers as pdfVersion.major and pdfVersion.minor
      
      instead of
      
        int major, minor;
        doc->getPdfVersion(&major, &minor);
      
      With C++17 you can even write
      
        auto [major, minor] = doc->getPdfVersion();
      
      The new method is put alongside the old one in the Qt5 interface.
      It replaces the old one in the Qt6 interface.
      13c95f25
  4. 12 Jul, 2021 2 commits
    • Nelson Benítez León's avatar
      glib: mimick TextSelectionDumper logic change for spaceAfter · fdb83a88
      Nelson Benítez León authored
      Commit d6cccfb8 caused
      issue #1100 because that change in the TextSelectionDumper
      logic *must be mimicked* in poppler_page_get_text_layout_for_area()
      and in poppler_page_get_text_attributes_for_area() because
      all those functions must be consistent with each other in
      the way they traverse and extract the text from the PDF.
      
      Otherwise, wrong results may happen when using them
      to map between graphical coordinates of text glyphs and
      their corresponding positions in the text obtained from
      poppler_page_get_text() (which uses TextSelectionDumper
      to extract the text).
      
      Fixes issue #1100
      fdb83a88
    • Nelson Benítez León's avatar
      Add glib test for issue #1100 · e2f7f5e8
      Nelson Benítez León authored
      e2f7f5e8
  5. 10 Jul, 2021 1 commit
  6. 08 Jul, 2021 2 commits
  7. 06 Jul, 2021 3 commits
    • Albert Astals Cid's avatar
      Update (C) · 1d23101c
      Albert Astals Cid authored
      1d23101c
    • RM's avatar
      Modify internal API to allow addition and modification of outlines into a PDF.... · fa494b78
      RM authored
      Modify internal API to allow addition and modification of outlines into a PDF. Tests in the qt5/qt6 directories.
      
      duplicate qt5 outline test in qt6 directory
      fa494b78
    • Zachary Travis's avatar
      Create fallback fonts as needed. · e674ca64
      Zachary Travis authored
      If a PDF form field value uses a font that is not in the resources dictionary, a warning is logged and the field value is ignored/not displayed. It's unclear whether this behavior is strictly valid based on the PDF spec (since typically font references, even to base fonts, require a corresponding font dictionary) but Acrobat seems to display the content anyway.
      e674ca64
  8. 05 Jul, 2021 1 commit
  9. 04 Jul, 2021 2 commits
    • Uli Schlachter's avatar
      Better error messages when libopenjpeg2 is not found · fcdff7bb
      Uli Schlachter authored
      When I run "cmake -DENABLE_DCTDECODER=none -DENABLE_BOOST=OFF" on my
      system, I get the following output:
      
          -- Found Iconv: /usr/lib/x86_64-linux-gnu/libc.so
          CMake Warning at CMakeLists.txt:252 (find_package):
            By not providing "FindOpenJPEG.cmake" in CMAKE_MODULE_PATH this project has
            asked CMake to find a package configuration file provided by "OpenJPEG",
            but CMake did not find one.
      
            Could not find a package configuration file provided by "OpenJPEG" with any
            of the following names:
      
              OpenJPEGConfig.cmake
              openjpeg-config.cmake
      
            Add the installation prefix of "OpenJPEG" to CMAKE_PREFIX_PATH or set
            "OpenJPEG_DIR" to a directory containing one of the above files.  If
            "OpenJPEG" provides a separate development package or SDK, be sure it has
            been installed.
      
          CMake Error at CMakeLists.txt:255 (message):
            Install libopenjpeg2 before trying to build poppler.  You can also decide...
      fcdff7bb
    • Uli Schlachter's avatar
      Better error message when libjpeg is not found · 27ea06e3
      Uli Schlachter authored
      
      
      When I run cmake on my system, I get the following output:
      
          -- Checking for module 'nss>=3.19'
          --   Package 'nss', required by 'virtual:world', not found
          -- Could NOT find NSS3 (missing: NSS3_LIBRARIES NSS3_CFLAGS)
          CMake Error at CMakeLists.txt:149 (message):
            Install libjpeg before trying to build poppler.  You can also decide to use
            the internal unmaintained DCT decoder or none at all.
      
          -- Configuring incomplete, errors occurred!
          See also "/tmp/poppler/build/CMakeFiles/CMakeOutput.log".
          See also "/tmp/poppler/build/CMakeFiles/CMakeError.log".
      
      Being (badly) trained in CMake errors, I see "Could NOT find NSS3" and
      conclude that this is the problem. I do not even read the actual error
      message.
      
      This commit improves the situation by producing the following output
      instead:
      
          -- Checking for module 'nss>=3.19'
          --   Package 'nss', required by 'virtual:world', not found
          -- Could NOT find NSS3 (missing: NSS3_LIBRARIES NSS3_CFLAGS)
          -- Could NOT find libjpeg.
          CMake Error at CMakeLists.txt:150 (message):
            Install libjpeg before trying to build poppler.  You can also decide to use
            the internal unmaintained DCT decoder or none at all.
      
            Possible options are: -DENABLE_DCTDECODER=libjpeg,
            -DENABLE_DCTDECODER=none, -DENABLE_DCTDECODER=unmaintained
      
          -- Configuring incomplete, errors occurred!
          See also "/tmp/poppler/build/CMakeFiles/CMakeOutput.log".
          See also "/tmp/poppler/build/CMakeFiles/CMakeError.log".
      
      This also explicitly lists the possible values for the parameter that I
      figured out by reading the code around CMakeLists.txt:151.
      Signed-off-by: Uli Schlachter's avatarUli Schlachter <psychon@znc.in>
      27ea06e3
  10. 02 Jul, 2021 2 commits
  11. 01 Jul, 2021 2 commits
    • Oliver Sander's avatar
      JBIG2Stream: Do not abort if size-0 allocations returns nullptr · 2b280871
      Oliver Sander authored
      The JBIG2SymbolDict constructor gets a size parameter, and it allocates
      memory for a bitmap of that size.  Bug report 535
      
        poppler/poppler#535
      
      has a file where this size is 0.  In that case, the call to
      gmallocn_checkoverflow returns nullptr, and subsequent calls to
      JBIG2SymbolDict::isOk return false.  This is then interpreted
      as an error, and the JBIG2 processing is aborted.  For the
      test file mentioned above this happens in line 1807.
      
      I don't know whether such a file with a size-0 symbol dict
      is malformed or not.  However, the test file renders just fine
      if the 'failing' allocation is simply ignored.  This patch
      therefore relaxes the isOk method a little.  A JBIG2SymbolDict
      object is now deemed 'ok' either if it holds a bitmap (that was
      the previous test) *or if it has size 0*.
      
      This fixes
      
        poppler/poppler#535
      2b280871
    • Uli Schlachter's avatar
      ~CairoOutputDev(): Free textClipPath · 571d8138
      Uli Schlachter authored
      The textClipPath member is set in CairoOutputDev::endString() and freed
      in CairoOutputDev::endTextObject(). However, if endTextObject() is not
      called for whatever reason, the path will just be leaked.
      
      This adds code to the destructor to free this.
      
      This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32326
      
      Testing done:
      
      $ wget -O testcase 'https://oss-fuzz.com/download?testcase_id=6659952325296128'
      [...]
      $ cmake .. -G Ninja -DENABLE_DCTDECODER=unmaintained -DENABLE_BOOST=OFF -DENABLE_LIBOPENJPEG=unmaintained && ninja
      [...]
      $ git describe
      poppler-21.06.1-5-gb7c40059
      
      
      $ valgrind --leak-check=full ./utils/pdftocairo testcase -png foo
      [...]
      ==104075==
      ==104075== HEAP SUMMARY:
      ==104075==     in use at exit: 28,292 bytes in 55 blocks
      ==104075==   total heap usage: 6,114 allocs, 6,059 frees, 1,617,444 bytes allocated
      ==104075==
      ==104075== 24 bytes in 1 blocks are definitely lost in loss record 4 of 37
      ==104075==    at 0x483877F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==104075==    by 0x48AE748: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11600.0)
      ==104075==    by 0x118995: endString (CairoOutputDev.cc:1474)
      ==104075==    by 0x118995: CairoOutputDev::endString(GfxState*) (CairoOutputDev.cc:1412)
      ==104075==    by 0x4B97295: Gfx::doShowText(GooString const*) (Gfx.cc:4010)
      ==104075==    by 0x4B97CB4: Gfx::opShowSpaceText(Object*, int) (Gfx.cc:3793)
      ==104075==    by 0x4B8D866: Gfx::go(bool) (Gfx.cc:681)
      ==104075==    by 0x4B8DCFA: display (Gfx.cc:642)
      ==104075==    by 0x4B8DCFA: Gfx::display(Object*, bool) (Gfx.cc:622)
      ==104075==    by 0x4BE1A83: Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) (Page.cc:576)
      ==104075==    by 0x11317C: renderPage (pdftocairo.cc:669)
      ==104075==    by 0x11317C: main (pdftocairo.cc:1183)
      ==104075==
      ==104075== LEAK SUMMARY:
      ==104075==    definitely lost: 24 bytes in 1 blocks
      ==104075==    indirectly lost: 0 bytes in 0 blocks
      ==104075==      possibly lost: 0 bytes in 0 blocks
      ==104075==    still reachable: 28,268 bytes in 54 blocks
      ==104075==         suppressed: 0 bytes in 0 blocks
      ==104075== Reachable blocks (those to which a pointer was found) are not shown.
      ==104075== To see them, rerun with: --leak-check=full --show-leak-kinds=all
      ==104075==
      ==104075== For lists of detected and suppressed errors, rerun with: -s
      ==104075== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
      $ git checkout cairo-leak-textClipPath && git describe && ninja
      Zu Branch 'cairo-leak-textClipPath' gewechselt
      poppler-21.06.1-6-g8df6f8d2
      $ valgrind --leak-check=full ./utils/pdftocairo testcase -png foo
      [...]
      ==104263==
      ==104263== HEAP SUMMARY:
      ==104263==     in use at exit: 28,268 bytes in 54 blocks
      ==104263==   total heap usage: 6,114 allocs, 6,060 frees, 1,617,444 bytes allocated
      ==104263==
      ==104263== LEAK SUMMARY:
      ==104263==    definitely lost: 0 bytes in 0 blocks
      ==104263==    indirectly lost: 0 bytes in 0 blocks
      ==104263==      possibly lost: 0 bytes in 0 blocks
      ==104263==    still reachable: 28,268 bytes in 54 blocks
      ==104263==         suppressed: 0 bytes in 0 blocks
      ==104263== Reachable blocks (those to which a pointer was found) are not shown.
      ==104263== To see them, rerun with: --leak-check=full --show-leak-kinds=all
      ==104263==
      ==104263== For lists of detected and suppressed errors, rerun with: -s
      ==104263== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
      
      As you (might) see, before this commit, there is a "definitely lost"
      leak of 24 bytes with this test case. After this commit, this leak is
      gone.
      Signed-off-by: Uli Schlachter's avatarUli Schlachter <psychon@znc.in>
      571d8138
  12. 26 Jun, 2021 1 commit
  13. 16 Jun, 2021 2 commits
  14. 15 Jun, 2021 1 commit
  15. 14 Jun, 2021 2 commits
  16. 03 Jun, 2021 1 commit
  17. 02 Jun, 2021 1 commit
  18. 01 Jun, 2021 1 commit
  19. 29 May, 2021 1 commit
  20. 28 May, 2021 1 commit
  21. 27 May, 2021 1 commit
  22. 25 May, 2021 3 commits
  23. 20 May, 2021 3 commits
  24. 19 May, 2021 1 commit
  25. 14 May, 2021 2 commits
    • Albert Astals Cid's avatar
      Update (C) · a89965b4
      Albert Astals Cid authored
      a89965b4
    • Mahmoud Khalil's avatar
      Provides the `wasReconstructed` value to caller · 2254e62a
      Mahmoud Khalil authored
      Modifies the Poppler backend library to call a callback method submitted
      by callers in case a XRef reconstruction occurs, as well as, providing
      an API for setting the callback from the qt5/qt6 frontend so that users
      be able to set callback and check whether it has already happened or
      not.
      
      FIXES #416
      2254e62a