gnu: libdvdcss: Update to 1.4.3.
[jackhill/guix/guix.git] / gnu / packages / pdf.scm
index 700968d..689d03a 100644 (file)
@@ -4,8 +4,8 @@
 ;;; Copyright © 2014, 2015, 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
-;;; Copyright © 2016 ng0 <ng0@n0.is>
-;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Nikita <nikita@n0.is>
+;;; Copyright © 2016, 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2017, 2018 Rene Saavedra <pacoon@protonmail.com>
-;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;; Copyright © 2019 Ben Sturmfels <ben@sturm.com.au>
-;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
-;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2019,2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2020, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -44,6 +47,7 @@
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system qt)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cups)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages djvu)
+  #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages game-development)
   #:use-module (gnu packages gcc)
@@ -67,7 +73,6 @@
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
-  #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages javascript)
   #:use-module (gnu packages lesstif)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tex)
+  #:use-module (gnu packages time)
+  #:use-module (gnu packages tcl)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages web)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (srfi srfi-1))
 
+(define-public extractpdfmark
+  (package
+    (name "extractpdfmark")
+    (version "1.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/trueroad/extractpdfmark")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "14aa6zly53j8gx5d32caiabk2j4b102xha0v9149yahz6kbn5b80"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'start-xorg-server
+           ;; The test suite wants to write to /homeless-shelter
+           (lambda _ (setenv "HOME" (getcwd)))))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gettext" ,gettext-minimal)
+       ("ghostscript" ,ghostscript)
+       ("pkg-config" ,pkg-config)
+       ("texlive" ,texlive-tiny)))
+    (inputs
+     `(("poppler" ,poppler)))
+    (home-page "https://github.com/trueroad/extractpdfmark")
+    (synopsis "Extract page mode and named destinations as PDFmark from PDF")
+    (description
+     "PDFmarks is a technique that accompanies PDF, and that is used to store
+metadata such as author or title, but also structural information such as
+bookmarks or hyperlinks.
+
+When Ghostscript reads the main PDF generated by the TeX system with embedded
+PDF files and outputs the final PDF, the PDF page mode and name targets
+etc. are not preserved.  Therefore, when you open the final PDF, it is not
+displayed correctly.  Also, remote PDF links do not work correctly.
+
+This program is able to extract the page mode and named targets as PDFmark
+from PDF.  In this way, you can obtain embedded PDF files that have kept this
+information.")
+    (license license:gpl3)))
+
+(define-public flyer-composer
+  (package
+    (name "flyer-composer")
+    (version "1.0rc2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "flyer-composer" version))
+       (sha256
+        (base32 "17igqb5dlcgcq4nimjw6cf9qgz6a728zdx1d0rr90r2z0llcchsv"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f ;; TODO
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'wrap-executable
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (qtbase (assoc-ref inputs "qtbase"))
+                    (qml "/lib/qt5/qml"))
+               (wrap-program (string-append out "/bin/flyer-composer-gui")
+                 `("QT_PLUGIN_PATH" ":" =
+                   (,(string-append qtbase "/lib/qt5/plugins")))
+                 `("QT_QPA_PLATFORM_PLUGIN_PATH" ":" =
+                   (,(string-append qtbase "/lib/qt5/plugins/platforms"))))
+               #t))))))
+    (inputs
+     `(("python-pypdf2" ,python-pypdf2)
+       ("python-pyqt" ,python-pyqt)
+       ("python-poppler-qt5" ,python-poppler-qt5)
+       ("qtbase" ,qtbase)))
+    (home-page "http://crazy-compilers.com/flyer-composer")
+    (synopsis "Rearrange PDF pages to print as flyers on one sheet")
+    (description "@command{flyer-composer} can be used to prepare one- or
+two-sided flyers for printing on one sheet of paper.
+
+Imagine you have designed a flyer in A6 format and want to print it using your
+A4 printer.  Of course, you want to print four flyers on each sheet.  This is
+where Flyer Composer steps in, creating a PDF which holds your flyer four
+times.  If you have a second page, Flyer Composer can arrange it the same way
+- even if the second page is in a separate PDF file.
+
+This package contains both the command line tool and the gui too.")
+    (license license:agpl3+)))
+
+(define-public flyer-composer-cli
+  (package/inherit flyer-composer
+    (name "flyer-composer-cli")
+    (arguments
+     `(#:tests? #f ;; TODO
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'remove-gui
+           (lambda _
+             (delete-file-recursively "flyer_composer/gui")
+             (substitute* "setup.cfg"
+               (("^\\s+flyer-composer-gui\\s*=.*") ""))
+             #t)))))
+    (inputs
+     `(("python-pypdf2" ,python-pypdf2)))
+    (description "@command{flyer-composer} can be used to prepare one- or
+two-sided flyers for printing on one sheet of paper.
+
+Imagine you have designed a flyer in A6 format and want to print it using your
+A4 printer.  Of course, you want to print four flyers on each sheet.  This is
+where Flyer Composer steps in, creating a PDF which holds your flyer four
+times.  If you have a second page, Flyer Composer can arrange it the same way
+- even if the second page is in a separate PDF file.
+
+This package contains only the command line tool.  If you like to use the gui,
+please install the @code{flyer-composer-gui} package.")))
+
 (define-public poppler
   (package
    (name "poppler")
 
              ;; To build poppler-glib (as needed by Evince), we need Cairo and
              ;; GLib.  But of course, that Cairo must not depend on Poppler.
-             ("cairo" ,(package (inherit cairo)
-                         (inputs (alist-delete "poppler"
-                                               (package-inputs cairo)))))))
+             ("cairo" ,cairo-sans-poppler)))
    (propagated-inputs
     ;; As per poppler-cairo and poppler-glib.pc.
     ;; XXX: Ideally we'd propagate Cairo too, but that would require a
 (define-public poppler-data
   (package
     (name "poppler-data")
-    (version "0.4.9")
+    (version "0.4.10")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://poppler.freedesktop.org/poppler-data"
                                   "-" version ".tar.gz"))
               (sha256
                (base32
-                "04i0wgdkn5lhda8cyxd1ll4a2p41pwqrwd47n9mdpl7cx5ypx70z"))))
+                "0c3vjs3p7rjc4yfacnhd865r27czmzwcr4j2z4jldi68dvvcwbvf"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:tests? #f ; no test suite
+     '(#:tests? #f                      ; no test suite
        #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out")))
        #:phases
        (modify-phases %standard-phases
@@ -175,13 +299,6 @@ When present, Poppler is able to correctly render CJK and Cyrillic text.")
     (license (list license:bsd-3
                    license:gpl2))))
 
-(define-public poppler-qt4
-  (package/inherit poppler
-   (name "poppler-qt4")
-   (inputs `(("qt-4" ,qt-4)
-             ,@(package-inputs poppler)))
-   (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
-
 (define-public poppler-qt5
   (package/inherit poppler
    (name "poppler-qt5")
@@ -192,14 +309,14 @@ When present, Poppler is able to correctly render CJK and Cyrillic text.")
 (define-public python-poppler-qt5
   (package
     (name "python-poppler-qt5")
-    (version "0.24.2")
+    (version "21.1.0")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "python-poppler-qt5" version))
         (sha256
          (base32
-          "0l69llw1fzwz8y90q0qp9q5pifbrqjjbwii7di54dwghw5fc6w1r"))))
+          "0b82gm4i75q5v19kfbq0h4y0b2vcwr2213zkhxh6l0h45kdndmxd"))))
     (build-system python-build-system)
     (arguments
      `(;; There are no tests.  The check phase just causes a rebuild.
@@ -222,7 +339,7 @@ When present, Poppler is able to correctly render CJK and Cyrillic text.")
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (inputs
-     `(("python-sip" ,python-sip)
+     `(("python-sip" ,python-sip-4)
        ("python-pyqt" ,python-pyqt)
        ("poppler-qt5" ,poppler-qt5)
        ("qtbase" ,qtbase)))
@@ -240,7 +357,7 @@ Poppler PDF rendering library.")
    (source (origin
              (method git-fetch)
              (uri (git-reference
-                   (url "https://github.com/libharu/libharu.git")
+                   (url "https://github.com/libharu/libharu")
                    (commit (string-append
                             "RELEASE_"
                             (string-join (string-split version #\.) "_")))))
@@ -272,47 +389,21 @@ reading and editing of existing PDF files.")
 (define-public xpdf
   (package
    (name "xpdf")
-   (version "4.02")
+   (version "4.03")
    (source
     (origin
       (method url-fetch)
-      (uri (string-append "https://xpdfreader-dl.s3.amazonaws.com/xpdf-"
-                          version "4.02.tar.gz"))
+      (uri (string-append "https://dl.xpdfreader.com/xpdf-" version ".tar.gz"))
       (sha256
-       (base32 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
-   (build-system gnu-build-system)
-   (inputs `(("freetype" ,freetype)
-             ("gs-fonts" ,gs-fonts)
-             ("lesstif" ,lesstif)
-             ("libpaper" ,libpaper)
-             ("libx11" ,libx11)
-             ("libxext" ,libxext)
-             ("libxp" ,libxp)
-             ("libxpm" ,libxpm)
-             ("libxt" ,libxt)
+       (base32 "0ip81c9vy0igjnasl9iv2lz214fb01vvvdzbvjmgwc63fi1jgr0g"))))
+   (build-system cmake-build-system)
+   (inputs `(("cups" ,cups)
+             ("freetype" ,freetype)
              ("libpng" ,libpng)
+             ("qtbase" ,qtbase)
              ("zlib" ,zlib)))
    (arguments
-    `(#:tests? #f                     ; there is no check target
-      #:parallel-build? #f            ; build fails randomly on 8-way machines
-      #:configure-flags
-        (list (string-append "--with-freetype2-includes="
-                             (assoc-ref %build-inputs "freetype")
-                             "/include/freetype2"))
-      #:phases
-      (modify-phases %standard-phases
-        (replace 'install
-          (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
-            (let* ((install (assoc-ref %standard-phases 'install))
-                   (out (assoc-ref outputs "out"))
-                   (xpdfrc (string-append out "/etc/xpdfrc"))
-                   (gs-fonts (assoc-ref inputs "gs-fonts")))
-              (apply install args)
-              (substitute* xpdfrc
-                (("/usr/local/share/ghostscript/fonts")
-                 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
-                (("#fontFile") "fontFile")))
-            #t)))))
+    `(#:tests? #f))                   ; there is no check target
    (synopsis "Viewer for PDF files based on the Motif toolkit")
    (description
     "Xpdf is a viewer for Portable Document Format (PDF) files.")
@@ -428,7 +519,7 @@ using the DjVuLibre library.")
 (define-public zathura-pdf-mupdf
   (package
     (name "zathura-pdf-mupdf")
-    (version "0.3.5")
+    (version "0.3.6")
     (source (origin
               (method url-fetch)
               (uri
@@ -436,7 +527,7 @@ using the DjVuLibre library.")
                               "/download/zathura-pdf-mupdf-" version ".tar.xz"))
               (sha256
                (base32
-                "1pjwsb7zwclxsvz229fl7y2saf1pv3ifwv3ay8viqxgrp9x3z9hq"))))
+                "1r3v37k9fl2rxipvacgxr36llywvy7n20a25h3ajlyk70697sa66"))))
     (native-inputs `(("pkg-config" ,pkg-config)))
     (inputs
      `(("jbig2dec" ,jbig2dec)
@@ -455,6 +546,12 @@ using the DjVuLibre library.")
                                "-Dlink-external=true")
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'remove-libmupdfthird.a-requirement
+           (lambda _
+             ;; Ignore a missing (apparently superfluous) static library.
+             (substitute* "meson.build"
+               ((".*mupdfthird.*") ""))
+             #t))
          (add-before 'configure 'add-mujs-to-dependencies
            (lambda _
              ;; Add mujs to the 'build_dependencies'.
@@ -508,7 +605,7 @@ by using the poppler rendering engine.")
 (define-public zathura
   (package
     (name "zathura")
-    (version "0.4.5")
+    (version "0.4.7")
     (source (origin
               (method url-fetch)
               (uri
@@ -516,7 +613,7 @@ by using the poppler rendering engine.")
                               version ".tar.xz"))
               (sha256
                (base32
-                "0b3nrcvykkpv2vm99kijnic2gpfzva520bsjlihaxandzfm9ff8c"))))
+                "1rx1fk9s556fk59lmqgvhwrmv71ashh89bx9adjq46wq5gzdn4p0"))))
     (native-inputs `(("pkg-config" ,pkg-config)
                      ("gettext" ,gettext-minimal)
                      ("glib:bin" ,glib "bin")
@@ -566,15 +663,14 @@ interaction.")
 (define-public podofo
   (package
     (name "podofo")
-    (version "0.9.6")
+    (version "0.9.7")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/podofo/podofo/" version
                                   "/podofo-" version ".tar.gz"))
               (sha256
                (base32
-                "0wj0y4zcmj4q79wrn3vv3xq4bb0vhhxs8yifafwy9f2sjm83c5p9"))
-              (patches (search-patches "podofo-cmake-3.12.patch"))))
+                "1f0yvkx6nf99fp741w2y706d8bs9824x1z2gqm3rdy5fv8bfgwkw"))))
     (build-system cmake-build-system)
     (native-inputs
      `(("cppunit" ,cppunit)
@@ -589,8 +685,8 @@ interaction.")
        ("openssl" ,openssl)
        ("zlib" ,zlib)))
     (arguments
-     `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
-                           "-DPODOFO_BUILD_STATIC=ON")
+     `(#:configure-flags
+       (list "-DPODOFO_BUILD_SHARED=ON")
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'patch
@@ -613,30 +709,36 @@ extracting content or merging files.")
 (define-public mupdf
   (package
     (name "mupdf")
-    (version "1.16.1")
+    (version "1.18.0")
     (source
-      (origin
-        (method url-fetch)
-        (uri (string-append "https://mupdf.com/downloads/archive/"
-                            name "-" version "-source.tar.xz"))
-        (sha256
-         (base32
-          "1npmy92lkj41nnc14b4fpq7z62pminy94zsdbrczj22jpn283rvg"))
-        (modules '((guix build utils)))
-        (snippet
-         ;; We keep lcms2 since it is different than our lcms.
-         '(begin
-            (for-each
-              (lambda (dir)
-                (delete-file-recursively (string-append "thirdparty/" dir)))
-              '("freeglut" "freetype" "harfbuzz" "jbig2dec"
-                "libjpeg" "mujs" "openjpeg" "zlib"))
-                #t))))
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://mupdf.com/downloads/archive/"
+                           "mupdf-" version "-source.tar.xz"))
+       (sha256
+        (base32 "16m5sksil22sshxy70xkslsb2qhvcqb1d95i9savnhds1xn4ybar"))
+       (patches (search-patches "mupdf-fix-linkage.patch"
+                                "mupdf-CVE-2021-3407.patch"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; Remove bundled software.
+           (let* ((keep (list "lcms2")) ; different from our lcms2 package
+                  (from "thirdparty")
+                  (kept (string-append from "~temp")))
+             (mkdir-p kept)
+             (for-each (lambda (file) (rename-file (string-append from "/" file)
+                                              (string-append kept "/" file)))
+                       keep)
+             (delete-file-recursively from)
+             (rename-file kept from))
+           #t))))
     (build-system gnu-build-system)
     (inputs
       `(("curl" ,curl)
         ("freeglut" ,freeglut)
         ("freetype" ,freetype)
+        ("gumbo-parser" ,gumbo-parser)
         ("harfbuzz" ,harfbuzz)
         ("jbig2dec" ,jbig2dec)
         ("libjpeg" ,libjpeg-turbo)
@@ -649,14 +751,19 @@ extracting content or merging files.")
     (native-inputs
       `(("pkg-config" ,pkg-config)))
     (arguments
-      '(#:tests? #f ; no check target
-        #:make-flags (list "CC=gcc"
+      `(#:tests? #f                     ; no check target
+        #:make-flags (list "verbose=yes"
+                           (string-append "CC=" ,(cc-for-target))
                            "XCFLAGS=-fpic"
                            "USE_SYSTEM_LIBS=yes"
                            "USE_SYSTEM_MUJS=yes"
+                           "shared=yes"
+                           ;; Even with the linkage patch we must fix RUNPATH.
+                           (string-append "LDFLAGS=-Wl,-rpath="
+                                          (assoc-ref %outputs "out") "/lib")
                            (string-append "prefix=" (assoc-ref %outputs "out")))
         #:phases (modify-phases %standard-phases
-                  (delete 'configure))))
+                   (delete 'configure)))) ; no configure script
     (home-page "https://mupdf.com")
     (synopsis "Lightweight PDF viewer and toolkit")
     (description
@@ -677,14 +784,14 @@ line tools for batch rendering @command{pdfdraw}, rewriting files
 (define-public qpdf
   (package
    (name "qpdf")
-   (version "9.1.1")
+   (version "10.0.1")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
                                 "/qpdf-" version ".tar.gz"))
             (sha256
              (base32
-              "0dj27wb9xg6pg95phbflfvy9rwxn1gh3kc4n175g0pf41r0zrim2"))))
+              "0yw2cpw7ygfd6jlgpwbi8vsnvv9p55zxp9h17x77z2qq733pf8jx"))))
    (build-system gnu-build-system)
    (arguments
     `(#:disallowed-references (,perl)
@@ -719,6 +826,54 @@ program capable of converting PDF into other formats.")
    (license (list license:asl2.0 license:clarified-artistic))
    (home-page "http://qpdf.sourceforge.net/")))
 
+(define-public qpdfview
+  (package
+    (name "qpdfview")
+    (version "0.4.18")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://launchpad.net/qpdfview/"
+                           "trunk/" version "/+download/"
+                           "qpdfview-" version ".tar.gz"))
+       (sha256
+        (base32 "0v1rl126hvblajnph2hkansgi0s8vjdc5yxrm4y3faa0lxzjwr6c"))
+       (patches (search-patches "qpdfview-qt515-compat.patch"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("cups" ,cups)
+       ("djvulibre" ,djvulibre)
+       ("libspectre" ,libspectre)
+       ("poppler-qt5" ,poppler-qt5)
+       ("qtbase" ,qtbase)
+       ("qtsvg" ,qtsvg)))
+    (arguments
+     `(#:imported-modules ((guix build qt-build-system)
+                           (guix build cmake-build-system)
+                           ,@%gnu-build-system-modules)
+       #:modules ((guix build utils)
+                  (guix build gnu-build-system)
+                  ((guix build qt-build-system) #:prefix qt:))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda _
+             (substitute* "qpdfview.pri"
+               (("/usr") (assoc-ref %outputs "out")))
+             (invoke "qmake" "qpdfview.pro")))
+         ;; Otherwise, the user interface will not display any icons.
+         (add-after 'install 'qt-wrap
+           (assoc-ref qt:%standard-phases 'qt-wrap)))))
+    (home-page "https://launchpad.net/qpdfview")
+    (synopsis "Tabbed document viewer")
+    (description "@command{qpdfview} is a document viewer for PDF, PS and DJVU
+files.  It uses the Qt toolkit and features persistent per-file settings,
+configurable toolbars and shortcuts, continuous and multi‐page layouts,
+SyncTeX support, and rudimentary support for annotations and forms.")
+    (license license:gpl2+)))
+
 (define-public xournal
   (package
     (name "xournal")
@@ -750,16 +905,16 @@ using a stylus.")
 (define-public xournalpp
   (package
     (name "xournalpp")
-    (version "1.0.17")
+    (version "1.0.20")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/xournalpp/xournalpp.git")
+             (url "https://github.com/xournalpp/xournalpp")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0xw2mcgnm4sa9hrhfgp669lfypw97drxjmz5w8i5whaprpvmkxzw"))))
+        (base32 "1c7n03xm3m4lwcwxgplkn25i8c6s3i7rijbkcx86br1j4jadcs3k"))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags (list "-DENABLE_CPPUNIT=ON") ;enable tests
@@ -772,20 +927,22 @@ using a stylus.")
        (modify-phases %standard-phases
          (add-after 'unpack 'fix-permissions-on-po-files
            (lambda _
-             ;; Always generate translations.  A recent upstream patch
-             ;; disabled it.
-             (substitute* "po/CMakeLists.txt"
-               (("gettext_create_translations \\(\"\\$\\{potfile\\}\"\\)")
-                "gettext_create_translations (\"${potfile}\" ALL)"))
              ;; Make sure 'msgmerge' can modify the PO files.
              (for-each (lambda (po) (chmod po #o666))
                        (find-files "." "\\.po$"))
              #t))
+         ;; Fix path to addr2line utility, which the crash reporter uses.
+         (add-after 'unpack 'fix-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "src/util/Stacktrace.cpp"
+               ;; Match only the commandline.
+               (("\"addr2line ")
+                (string-append "\"" (which "addr2line") " ")))
+             #t))
          (add-after 'install 'glib-or-gtk-wrap
            (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
     (native-inputs
      `(("cppunit" ,cppunit)
-       ("gcc" ,gcc-8)                   ;requires gcc 8+
        ("gettext" ,gettext-minimal)
        ("pkg-config" ,pkg-config)))
     (inputs
@@ -813,7 +970,7 @@ Xournal++ features:
 @item Fill shape functionality
 @item PDF Export (with and without paper style)
 @item PNG Export (with and without transparent background)
-@item Allow to map different tools / colors etc. to stylus buttons /
+@item Map different tools / colors etc. to stylus buttons /
 mouse buttons
 @item Sidebar with Page Previews with advanced page sorting, PDF
 Bookmarks and Layers (can be individually hidden, editing layer can be
@@ -838,20 +995,44 @@ optimize toolbar for portrait / landscape
 (define-public python-reportlab
   (package
     (name "python-reportlab")
-    (version "3.5.32")
+    (version "3.5.42")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "reportlab" version))
               (sha256
                (base32
-                "0lf8hil9nbm74zl27l8rydxbhwnpr0pbghibsqrc9sglds9l9vw3"))))
+                "0i17qgm7gzy7pzp240mkpsx9rn8rr67jh5npp5bylv3sd41g48cw"))))
     (build-system python-build-system)
     (arguments
-     '(;; FIXME: There is one test failure, but it does not cause the
-       ;; build to fail. No time to investigate right now.
-       #:test-target "tests"))
+     '(;; FIXME: There is one test failure, building the pdf manual from source,
+       ;; but it does not cause the build to fail.
+       #:test-target "tests"
+       #:configure-flags (list "--use-system-libart")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'find-libraries
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((libart (assoc-ref inputs "libart-lgpl"))
+                   (freetype (assoc-ref inputs "freetype"))
+                   (dlt1 (assoc-ref inputs "font-curve-files")))
+               (substitute* "setup.py"
+                 (("/usr/include/libart-\\*")
+                  (string-append libart "/include/libart-2.0"))
+                 (("/usr/include/freetype2")
+                  (string-append freetype "/include"))
+                 (("http://www.reportlab.com/ftp/pfbfer-20180109.zip")
+                  (string-append "file://" dlt1)))
+               #t))))))
     (inputs
-     `(("freetype" ,freetype)))
+     `(("freetype" ,freetype)
+       ("libart-lgpl" ,libart-lgpl)
+       ("font-curve-files"
+        ,(origin
+           (method url-fetch)
+           (uri "http://www.reportlab.com/ftp/pfbfer-20180109.zip")
+           (sha256
+            (base32
+             "1v0gy4mbx02ys96ssx89420y0njknlrxs2bx64bv4rp8a0al66w5"))))))
     (propagated-inputs
      `(("python-pillow" ,python-pillow)))
     (home-page "https://www.reportlab.com")
@@ -917,6 +1098,29 @@ such as zooming, highlighting an area of the screen, and a tool to navigate
 the PDF pages.")
     (license license:gpl2)))
 
+(define-public img2pdf
+  (package
+    (name "img2pdf")
+    (version "0.4.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "img2pdf" version))
+       (sha256
+        (base32 "1jdhmpzgj8815bhargb3xp3ydlqxwkz0mcadrflx2ga0p056kvpa"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-pikepdf" ,python-pikepdf)
+       ("python-pillow" ,python-pillow)
+       ("python-tkinter" ,python "tk")))
+    (home-page "https://gitlab.mister-muffin.de/josch/img2pdf")
+    (synopsis "Convert images to PDF via direct JPEG inclusion")
+    (description
+     "img2pdf converts images to PDF via direct JPEG inclusion.  That
+conversion is lossless: the image embedded in the PDF has the exact same color
+information for every pixel as the input.")
+    (license license:lgpl3)))
+
 (define-public fbida
   (package
     (name "fbida")
@@ -948,7 +1152,6 @@ the PDF pages.")
               ("libudev" ,eudev)
               ("libwebp" ,libwebp)
               ("libdrm" ,libdrm)
-              ("imagemagick" ,imagemagick)
               ("giflib" ,giflib)
               ("glib" ,glib)
               ("cairo-xcb" ,cairo-xcb)
@@ -974,7 +1177,7 @@ the framebuffer.")
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                    (url "https://github.com/dawbarton/pdf2svg.git")
+                    (url "https://github.com/dawbarton/pdf2svg")
                     (commit (string-append "v" version))))
               (file-name (git-file-name name version))
               (sha256
@@ -1066,19 +1269,19 @@ python-pypdf2 instead.")
 (define-public pdfarranger
   (package
     (name "pdfarranger")
-    (version "1.3.1")
+    (version "1.7.1")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/jeromerobert/pdfarranger.git")
+             (url "https://github.com/jeromerobert/pdfarranger")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1f8m8r81322i97wkqpmf7a4kiwnq244n6cnbldh03jc49vwq2kxx"))))
+        (base32 "1c2mafnz8pv32wzkc2wx4q8y2x7xffpn6ag12dj7ga5n772fb6s3"))))
     (build-system python-build-system)
     (arguments
-     '(#:tests? #f                                ;no tests
+     '(#:tests? #f                      ;no tests
        #:phases (modify-phases %standard-phases
                   (add-after 'install 'wrap-for-typelib
                     (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -1091,12 +1294,15 @@ python-pypdf2 instead.")
     (native-inputs
      `(("intltool" ,intltool)
        ("python-distutils-extra" ,python-distutils-extra)))
-    (propagated-inputs
+    (inputs
      `(("gtk+" ,gtk+)
-       ("poppler" ,poppler)
+       ("poppler" ,poppler)))
+    (propagated-inputs
+     `(("img2pdf" ,img2pdf)
+       ("python-dateutil" ,python-dateutil)
+       ("python-pikepdf" ,python-pikepdf)
        ("python-pycairo" ,python-pycairo)
-       ("python-pygobject" ,python-pygobject)
-       ("python-pypdf2" ,python-pypdf2)))
+       ("python-pygobject" ,python-pygobject)))
     (home-page "https://github.com/jeromerobert/pdfarranger")
     (synopsis "Merge, split and re-arrange pages from PDF documents")
     (description
@@ -1166,16 +1372,16 @@ multiple files.")
 (define-public pdfpc
   (package
     (name "pdfpc")
-    (version "4.3.4")
+    (version "4.4.1")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/pdfpc/pdfpc.git")
+             (url "https://github.com/pdfpc/pdfpc")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "07aafsm4jzdgpahz83p0ajv40hry7gviyadqi13ahr8xdhhwy2sd"))))
+        (base32 "11n925c5jj3yfwnqkgxzqrmsrpqh8ls1g4idmqqzpsanpam1xvna"))))
     (build-system cmake-build-system)
     (arguments '(#:tests? #f))          ; no test target
     (inputs
@@ -1221,38 +1427,34 @@ presentation.  The input files processed by pdfpc are PDF documents.")
     (synopsis "Pango to PostScript converter")
     (description
      "Paps reads a UTF-8 encoded file and generates a PostScript language
-rendering of the file.  The rendering is done by creating outline curves
-through the Pango @code{ft2} backend.")
+rendering of the file through the Pango Cairo back end.")
     (license license:lgpl2.0+)))
 
 (define-public stapler
   (package
     (name "stapler")
-    (version "0.3.2")
+    (version "1.0.0")
     (source
      (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/hellerbarde/stapler")
-             (commit version)))
-       (file-name (git-file-name name version))
+       (method url-fetch)
+       (uri (pypi-uri "stapler" version))
        (sha256
         (base32
-         "06w7xanzr7cicqik62g7zqs57j4y6fc7hflrc1rlmphxx40hkg6r"))))
+         "0b2lbm3f79cdxcsagwhzihbzwahjabxqmbws0c8ki25gpdnygdd7"))))
     (build-system python-build-system)
-    (inputs
-     `(("python2-pypdf2" ,python2-pypdf2)))
     (arguments
-     `(#:python ,python-2
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'fix-pypdf-version-requirement
-           ;; A PyPDF2 version requirement of 1.25.1 is hard-coded in
-           ;; setup.py. Relax it to work with any version of PyPDF2.
+         (add-after 'unpack 'fix-more-itertools-version-requirement
            (lambda _
+             ;; Tests require an version of the more-itertools module older
+             ;; than the one we have packaged.
              (substitute* "setup.py"
-               (("PyPDF2==1.25.1") "PyPDF2"))
+               (("more-itertools>=2\\.2,<6\\.0\\.0") "more-itertools>=2.2"))
              #t)))))
+    (propagated-inputs
+     `(("python-more-itertools" ,python-more-itertools)
+       ("python-pypdf2" ,python-pypdf2)))
     (home-page "https://github.com/hellerbarde/stapler")
     (synopsis "PDF manipulation tool")
     (description "Stapler is a pure Python alternative to PDFtk, a tool for
@@ -1270,14 +1472,17 @@ manipulating PDF documents from the command line.  It supports
 (define-public weasyprint
   (package
     (name "weasyprint")
-    (version "51")
+    (version "52.1")
     (source
      (origin
-       (method url-fetch)
-       (uri (pypi-uri "WeasyPrint" version))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/FelixSchwarz/WeasyPrint")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "0skdzwq7cd715dnnds6abx0k0xmmnmsqp0vb1r1w20sg7abp3sdk"))
-       (patches (search-patches "weasyprint-library-paths.patch"))))
+        (base32
+         "0rcj9yah3bp6bbvkmny3w4csx4l5v49lc7mrk29g0x77qnwswjy7"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -1289,27 +1494,39 @@ manipulating PDF documents from the command line.  It supports
                    (pango (assoc-ref inputs "pango"))
                    (pangoft2 (assoc-ref inputs "pangoft2")))
                (substitute* "weasyprint/fonts.py"
-                 (("@fontconfig@")
-                  (string-append fontconfig "/lib/libfontconfig.so"))
-                 (("@pangoft2@")
-                  (string-append pango "/lib/libpangoft2-1.0.so")))
+                 (("'fontconfig'")
+                  (format #f "'~a/lib/libfontconfig.so'" fontconfig))
+                 (("'pangoft2-1.0'")
+                  (format #f "'~a/lib/libpangoft2-1.0.so'" pango)))
                (substitute* "weasyprint/text.py"
-                 (("@gobject@")
-                  (string-append glib "/lib/libgobject-2.0.so"))
-                 (("@pango@")
-                  (string-append pango "/lib/libpango-1.0.so"))
-                 (("@pangocairo@")
-                  (string-append pango "/lib/libpangocairo-1.0.so"))))))
-         (add-after 'unpack 'remove-pytest-options
+                 (("'gobject-2.0'")
+                  (format #f "'~a/lib/libgobject-2.0.so'" glib))
+                 (("'pango-1.0'")
+                  (format #f "'~a/lib/libpango-1.0.so'" pango))
+                 (("'pangocairo-1.0'")
+                  (format #f "'~a/lib/libpangocairo-1.0.so'" pango)))
+               #t)))
+         (add-after 'unpack 'disable-linters
+           ;; Their check fails; none of our business.
            (lambda _
              (substitute* "setup.cfg"
-               ;; flake8 and isort syntax checks fail, which is not our
-               ;; business.
-               (("addopts = --flake8 --isort") ""))))
-         (replace 'check
-           (lambda _
-             ;; Run pytest, excluding one failing test.
-             (invoke "pytest" "-k" "not test_flex_column_wrap_reverse"))))))
+               ((".*pytest-flake8.*") "")
+               ((".*pytest-isort.*") "")
+               (("--flake8") "")
+               (("--isort") ""))
+             #t))
+         (add-before 'check 'register-dejavu-font
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; TODO: fix FreeType so that fonts found in XDG_DATA_DIRS are
+             ;; honored.
+             (let* ((HOME "/tmp")
+                    (dejavu (assoc-ref inputs "font-dejavu"))
+                    (fonts-dir (string-append HOME "/.fonts")))
+               (setenv "HOME" HOME)
+               (mkdir-p fonts-dir)
+               (symlink (string-append dejavu "/share/fonts/truetype")
+                        (string-append fonts-dir "/truetype"))
+               (invoke "fc-cache" "-rv")))))))
     (inputs
      `(("fontconfig" ,fontconfig)
        ("glib" ,glib)
@@ -1324,7 +1541,8 @@ manipulating PDF documents from the command line.  It supports
        ("python-pyphen" ,python-pyphen)
        ("python-tinycss2" ,python-tinycss2)))
     (native-inputs
-     `(("python-pytest-cov" ,python-pytest-cov)
+     `(("font-dejavu" ,font-dejavu)     ;tests depend on it
+       ("python-pytest-cov" ,python-pytest-cov)
        ("python-pytest-runner" ,python-pytest-runner)))
     (home-page "https://weasyprint.org/")
     (synopsis "Document factory for creating PDF files from HTML")