gnu: libdvdcss: Update to 1.4.3.
[jackhill/guix/guix.git] / gnu / packages / pdf.scm
index d03379c..689d03a 100644 (file)
@@ -17,7 +17,7 @@
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;; Copyright © 2019 Ben Sturmfels <ben@sturm.com.au>
 ;;; Copyright © 2019,2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
-;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; 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>
@@ -92,6 +92,8 @@
   #: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 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")
@@ -251,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")
@@ -268,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.
@@ -298,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)))
@@ -348,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.")
@@ -702,7 +717,8 @@ extracting content or merging files.")
                            "mupdf-" version "-source.tar.xz"))
        (sha256
         (base32 "16m5sksil22sshxy70xkslsb2qhvcqb1d95i9savnhds1xn4ybar"))
-       (patches (search-patches "mupdf-fix-linkage.patch"))
+       (patches (search-patches "mupdf-fix-linkage.patch"
+                                "mupdf-CVE-2021-3407.patch"))
        (modules '((guix build utils)))
        (snippet
         '(begin
@@ -821,7 +837,8 @@ program capable of converting PDF into other formats.")
                            "trunk/" version "/+download/"
                            "qpdfview-" version ".tar.gz"))
        (sha256
-        (base32 "0v1rl126hvblajnph2hkansgi0s8vjdc5yxrm4y3faa0lxzjwr6c"))))
+        (base32 "0v1rl126hvblajnph2hkansgi0s8vjdc5yxrm4y3faa0lxzjwr6c"))
+       (patches (search-patches "qpdfview-qt515-compat.patch"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)))
@@ -1081,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")
@@ -1229,7 +1269,7 @@ python-pypdf2 instead.")
 (define-public pdfarranger
   (package
     (name "pdfarranger")
-    (version "1.3.1")
+    (version "1.7.1")
     (source
      (origin
        (method git-fetch)
@@ -1238,10 +1278,10 @@ python-pypdf2 instead.")
              (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)
@@ -1254,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