1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014, 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
6 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
7 ;;; Coypright © 2016 ng0 <ng0@we.make.ritual.n0.is>
8 ;;; Coypright © 2016 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Coypright © 2016 Marius Bakke <mbakke@fastmail.com>
10 ;;; Coypright © 2016 Ludovic Courtès <ludo@gnu.org>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages pdf)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix utils)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system python)
35 #:use-module (guix build-system trivial)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages bash)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages fontutils)
42 #:use-module (gnu packages game-development)
43 #:use-module (gnu packages ghostscript)
44 #:use-module (gnu packages databases)
45 #:use-module (gnu packages djvu)
46 #:use-module (gnu packages gettext)
47 #:use-module (gnu packages backup)
48 #:use-module (gnu packages lesstif)
49 #:use-module (gnu packages image)
50 #:use-module (gnu packages pkg-config)
51 #:use-module (gnu packages qt)
52 #:use-module (gnu packages xorg)
53 #:use-module (gnu packages gnome)
54 #:use-module (gnu packages glib)
55 #:use-module (gnu packages gtk)
56 #:use-module (gnu packages lua)
57 #:use-module (gnu packages curl)
58 #:use-module (gnu packages pcre)
59 #:use-module (gnu packages perl)
60 #:use-module (gnu packages python)
61 #:use-module (gnu packages sdl)
62 #:use-module (gnu packages tls)
63 #:use-module (srfi srfi-1))
65 (define-public poppler
71 (uri (string-append "https://poppler.freedesktop.org/poppler-"
75 "0hnjkcqqk87dw3hlda4gh4l7brkslniax9a79g772jn3iwiffwmq"))))
76 (build-system gnu-build-system)
79 (inputs `(("fontconfig" ,fontconfig)
80 ("freetype" ,freetype)
85 ("openjpeg-1" ,openjpeg-1)
88 ;; To build poppler-glib (as needed by Evince), we need Cairo and
89 ;; GLib. But of course, that Cairo must not depend on Poppler.
90 ("cairo" ,(package (inherit cairo)
91 (inputs (alist-delete "poppler"
92 (package-inputs cairo)))))
95 `(("pkg-config" ,pkg-config)
96 ("glib" ,glib "bin") ; glib-mkenums, etc.
97 ("gobject-introspection" ,gobject-introspection)))
99 `(#:tests? #f ; no test data provided with the tarball
101 '("--enable-xpdf-headers" ; to install header files
104 ;; Saves 8 MiB of .a files.
107 (modify-phases %standard-phases
108 (add-before 'configure 'setenv
111 (string-append (assoc-ref %build-inputs "openjpeg-1")
112 "/include/openjpeg-1.5"
113 ":" (or (getenv "CPATH") ""))))))))
114 (synopsis "PDF rendering library")
116 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
117 (license license:gpl2+)
118 (home-page "https://poppler.freedesktop.org/")))
120 (define-public poppler-qt4
121 (package (inherit poppler)
123 (inputs `(("qt-4" ,qt-4)
124 ,@(package-inputs poppler)))
125 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
127 (define-public poppler-qt5
128 (package (inherit poppler)
130 (inputs `(("qtbase" ,qtbase)
131 ,@(package-inputs poppler)))
133 (substitute-keyword-arguments (package-arguments poppler)
134 ((#:configure-flags flags)
135 `(cons "CXXFLAGS=-std=gnu++11" ,flags))))
136 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
138 (define-public python-poppler-qt4
140 (name "python-poppler-qt4")
145 (uri (string-append "https://pypi.python.org/packages/source/p"
146 "/python-poppler-qt4/python-poppler-qt4-"
150 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
151 (build-system python-build-system)
154 (modify-phases %standard-phases
156 'unpack 'patch-poppler-include-paths
158 (substitute* (find-files "." "poppler-.*\\.sip")
159 (("qt4/poppler-.*\\.h" header)
160 (string-append "poppler/" header)))
163 `(("pkg-config" ,pkg-config)))
165 `(("python-sip" ,python-sip)
166 ("python-pyqt-4" ,python-pyqt-4)
167 ("poppler-qt4" ,poppler-qt4)))
168 (home-page "https://pypi.python.org/pypi/python-poppler-qt4")
169 (synopsis "Python bindings for Poppler-Qt4")
171 "This package provides Python bindings for the Qt4 interface of the
172 Poppler PDF rendering library.")
173 (license license:lgpl2.1+)))
175 (define-public libharu
181 (uri (string-append "https://github.com/libharu/libharu/archive/"
183 (string-join (string-split version #\.) "_")
185 (file-name (string-append name "-" version ".tar.gz"))
188 "1lm4v539y9cb1lvbq387j57sy7yxda3yv8b1pk8m6zazbp66i7lg"))))
189 (build-system gnu-build-system)
192 (list (string-append "--with-zlib="
193 (assoc-ref %build-inputs "zlib"))
194 (string-append "--with-png="
195 (assoc-ref %build-inputs "libpng")))
197 (modify-phases %standard-phases
198 (add-before 'configure 'autogen
199 (lambda _ (zero? (system* "autoreconf" "-vif")))))))
204 `(("autoconf" ,autoconf)
205 ("automake" ,automake)
206 ("libtool" ,libtool)))
207 (home-page "http://libharu.org/")
208 (synopsis "Library for generating PDF files")
210 "libHaru is a library for generating PDF files. libHaru does not support
211 reading and editing of existing PDF files.")
212 (license license:zlib)))
220 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
223 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
224 (build-system gnu-build-system)
225 (inputs `(("freetype" ,freetype)
226 ("gs-fonts" ,gs-fonts)
228 ("libpaper" ,libpaper)
237 `(#:tests? #f ; there is no check target
238 #:parallel-build? #f ; build fails randomly on 8-way machines
240 (list (string-append "--with-freetype2-includes="
241 (assoc-ref %build-inputs "freetype")
242 "/include/freetype2"))
246 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
247 (let* ((install (assoc-ref %standard-phases 'install))
248 (out (assoc-ref outputs "out"))
249 (xpdfrc (string-append out "/etc/xpdfrc"))
250 (gs-fonts (assoc-ref inputs "gs-fonts")))
253 (("/usr/local/share/ghostscript/fonts")
254 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
255 (("#fontFile") "fontFile"))))
257 (synopsis "Viewer for PDF files based on the Motif toolkit")
259 "Xpdf is a viewer for Portable Document Format (PDF) files.")
260 (license license:gpl3) ; or gpl2, but not gpl2+
261 (home-page "http://www.foolabs.com/xpdf/")))
263 (define-public zathura-cb
270 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
274 "1zbazysdjwwnzw01qlnzyixwmsi8rqskc76mp81qcr3rpl96jprp"))))
275 (native-inputs `(("pkg-config" ,pkg-config)))
276 (propagated-inputs `(("girara" ,girara)))
277 (inputs `(("libarchive" ,libarchive)
279 ("zathura" ,zathura)))
280 (build-system gnu-build-system)
282 `(#:make-flags (list (string-append "PREFIX=" %output)
283 (string-append "PLUGINDIR=" %output "/lib/zathura")
285 #:tests? #f ; Package does not contain tests.
287 (alist-delete 'configure %standard-phases)))
288 (home-page "https://pwmt.org/projects/zathura-cb/")
289 (synopsis "Comic book support for zathura (libarchive backend)")
290 (description "The zathura-cb plugin adds comic book support to zathura
292 (license license:zlib)))
294 (define-public zathura-ps
301 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
305 "18wsfy8pqficdgj8wy2aws7j4fy8z78157rhqk17mj5f295zgvm9"))))
306 (native-inputs `(("pkg-config" ,pkg-config)))
307 (propagated-inputs `(("girara" ,girara)))
308 (inputs `(("libspectre" ,libspectre)
310 ("zathura" ,zathura)))
311 (build-system gnu-build-system)
313 `(#:make-flags (list (string-append "PREFIX=" %output)
314 (string-append "PLUGINDIR=" %output "/lib/zathura")
316 #:tests? #f ; Package does not contain tests.
318 (alist-delete 'configure %standard-phases)))
319 (home-page "https://pwmt.org/projects/zathura-ps/")
320 (synopsis "PS support for zathura (libspectre backend)")
321 (description "The zathura-ps plugin adds PS support to zathura
323 (license license:zlib)))
325 (define-public zathura-djvu
327 (name "zathura-djvu")
332 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
336 "03cw54d2fipvbrnbqy0xccqkx6s77dyhyymx479aj5ryy4513dq8"))))
337 (native-inputs `(("pkg-config" ,pkg-config)))
338 (propagated-inputs `(("girara" ,girara)))
340 `(("djvulibre" ,djvulibre)
342 ("zathura" ,zathura)))
343 (build-system gnu-build-system)
345 `(#:make-flags (list (string-append "PREFIX=" %output)
346 (string-append "PLUGINDIR=" %output "/lib/zathura")
348 #:tests? #f ; Package does not contain tests.
350 (alist-delete 'configure %standard-phases)))
351 (home-page "https://pwmt.org/projects/zathura-djvu/")
352 (synopsis "DjVu support for zathura (DjVuLibre backend)")
353 (description "The zathura-djvu plugin adds DjVu support to zathura
354 using the DjVuLibre library.")
355 (license license:zlib)))
357 (define-public zathura-pdf-poppler
359 (name "zathura-pdf-poppler")
364 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
368 "1maqiv7yv8d8hymlffa688c5z71v85kbzmx2j88i8z349xx0rsyi"))))
369 (native-inputs `(("pkg-config" ,pkg-config)))
370 (propagated-inputs `(("girara" ,girara)))
372 `(("poppler" ,poppler)
376 (build-system gnu-build-system)
378 `(#:make-flags (list (string-append "PREFIX=" %output)
379 (string-append "PLUGINDIR=" %output "/lib/zathura")
381 #:tests? #f ; Package does not include tests.
383 (alist-delete 'configure %standard-phases)))
384 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
385 (synopsis "PDF support for zathura (poppler backend)")
386 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
387 by using the poppler rendering engine.")
388 (license license:zlib)))
390 (define-public zathura
397 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
401 "0fyb5hak0knqvg90rmdavwcmilhnrwgg1s5ykx9wd3skbpi8nsh8"))
402 (patches (search-patches
403 "zathura-plugindir-environment-variable.patch"))))
404 (native-inputs `(("pkg-config" ,pkg-config)
405 ("gettext" ,gettext-minimal)))
406 (inputs `(("girara" ,girara)
410 (list (search-path-specification
411 (variable "ZATHURA_PLUGIN_PATH")
412 (files '("lib/zathura")))))
413 (build-system gnu-build-system)
416 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
418 #:tests? #f ; Tests fail: "Gtk cannot open display".
421 (alist-delete 'configure %standard-phases)))
422 (home-page "https://pwmt.org/projects/zathura/")
423 (synopsis "Lightweight keyboard-driven PDF viewer")
424 (description "Zathura is a customizable document viewer. It provides a
425 minimalistic interface and an interface that mainly focuses on keyboard
427 (license license:zlib)))
429 (define-public podofo
435 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
436 "/podofo-" version ".tar.gz"))
439 "1n12lbq9x15vqn7dc0hsccp56l5jdff1xrhvlfqlbklxx0qiw9pc"))))
440 (build-system cmake-build-system)
441 (inputs ; TODO: Add cppunit for tests
445 ("fontconfig" ,fontconfig)
447 ("libjpeg" ,libjpeg-8)
448 ("freetype" ,freetype)
451 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
452 "-DPODOFO_BUILD_STATIC=ON")
456 (lambda* (#:key inputs #:allow-other-keys)
457 (let ((freetype (assoc-ref inputs "freetype")))
458 ;; Look for freetype include files in the correct place.
459 (substitute* "cmake/modules/FindFREETYPE.cmake"
460 (("/usr/local") freetype))))
462 (home-page "http://podofo.sourceforge.net")
463 (synopsis "Tools to work with the PDF file format")
465 "PoDoFo is a C++ library and set of command-line tools to work with the
466 PDF file format. It can parse PDF files and load them into memory, and makes
467 it easy to modify them and write the changes to disk. It is primarily useful
468 for applications that wish to do lower level manipulation of PDF, such as
469 extracting content or merging files.")
470 (license license:lgpl2.0+)))
479 (uri (string-append "http://mupdf.com/downloads/archive/"
480 name "-" version "-source.tar.gz"))
483 "1k64pdapyj8a336jw3j61fhn0rp4q6az7d0dqp9r5n3d9rgwa5c0"))
484 (patches (search-patches "mupdf-build-with-openjpeg-2.1.patch"
485 "mupdf-CVE-2016-6265.patch"
486 "mupdf-CVE-2016-6525.patch"))
487 (modules '((guix build utils)))
489 ;; Delete all the bundled libraries except for mujs, which is
490 ;; developed by the same team as mupdf and has no releases.
491 ;; TODO Package mujs and don't use the bundled copy.
492 '(for-each delete-file-recursively
494 "thirdparty/freetype"
496 "thirdparty/harfbuzz"
497 "thirdparty/jbig2dec"
499 "thirdparty/openjpeg"
500 "thirdparty/zlib")))))
501 (build-system gnu-build-system)
504 ("freetype" ,freetype)
505 ("harfbuzz" ,harfbuzz)
506 ("jbig2dec" ,jbig2dec)
510 ("openjpeg" ,openjpeg)
514 `(("pkg-config" ,pkg-config)))
516 '(#:tests? #f ; no check target
517 #:make-flags (list "CC=gcc"
519 (string-append "prefix=" (assoc-ref %outputs "out")))
520 #:phases (modify-phases %standard-phases
521 (delete 'configure))))
522 (home-page "http://mupdf.com")
523 (synopsis "Lightweight PDF viewer and toolkit")
525 "MuPDF is a C library that implements a PDF and XPS parsing and
526 rendering engine. It is used primarily to render pages into bitmaps,
527 but also provides support for other operations such as searching and
528 listing the table of contents and hyperlinks.
530 The library ships with a rudimentary X11 viewer, and a set of command
531 line tools for batch rendering (pdfdraw), rewriting files (pdfclean),
532 and examining the file structure (pdfshow).")
533 (license license:agpl3+)))
541 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
542 "/qpdf-" version ".tar.gz"))
545 "0csj2p2gkxrc0rk8ykymlsdgfas96vzf1dip3y1x7z1q9plwgzd9"))
546 (modules '((guix build utils)))
548 ;; Replace shebang with the bi-lingual shell/Perl trick to remove
549 ;; dependency on Perl.
550 '(substitute* "qpdf/fix-qdf"
551 (("#!/usr/bin/env perl")
553 eval '(exit $?0)' && eval 'exec perl -wS \"$0\" ${1+\"$@\"}'
554 & eval 'exec perl -wS \"$0\" $argv:q'
556 (build-system gnu-build-system)
558 `(#:disallowed-references (,perl)
560 (modify-phases %standard-phases
561 (add-before 'configure 'patch-paths
563 (substitute* "make/libtool.mk"
565 (string-append "SHELL=" (which "bash"))))
567 '("qtest/bin/qtest-driver")
568 (find-files "." "\\.test"))
569 (("/usr/bin/env") (which "env"))))))))
571 `(("pkg-config" ,pkg-config)
577 (synopsis "Command-line tools and library for transforming PDF files")
579 "QPDF is a command-line program that does structural, content-preserving
580 transformations on PDF files. It could have been called something like
581 pdf-to-pdf. It includes support for merging and splitting PDFs and to
582 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
583 program capable of converting PDF into other formats.")
584 (license license:clarified-artistic)
585 (home-page "http://qpdf.sourceforge.net/")))
587 (define-public xournal
594 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
595 "/xournal-" version ".tar.gz"))
598 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
599 (build-system gnu-build-system)
605 ("libgnomecanvas" ,libgnomecanvas)))
607 `(("pkg-config" ,pkg-config)))
608 (home-page "http://xournal.sourceforge.net/")
609 (synopsis "Notetaking using a stylus")
611 "Xournal is an application for notetaking, sketching, keeping a journal
613 (license license:gpl2+)))
615 (define-public python-reportlab
617 (name "python-reportlab")
621 (uri (pypi-uri "reportlab" version))
624 "0rz2pg04wnzjjm2f5a8ik9v8s54mv4xrjhv5liqjijqv6awh12gl"))))
625 (build-system python-build-system)
627 ;; Prevent creation of the egg. Without this flag, various artifacts
628 ;; from the build inputs end up in the final python3 output. It also
629 ;; works around https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20765 .
630 `(#:configure-flags '("--single-version-externally-managed" "--root=/")))
632 `(("python-pillow" ,python-pillow)))
633 (home-page "http://www.reportlab.com")
634 (synopsis "Python library for generating PDFs and graphics")
635 (description "This is the ReportLab PDF Toolkit. It allows rapid creation
636 of rich PDF documents, and also creation of charts in a variety of bitmap and
638 (license license:bsd-3)
639 (properties `((python2-variant . ,(delay python2-reportlab))))))
641 (define-public python2-reportlab
643 (inherit (package-with-python2
644 (strip-python2-variant python-reportlab)))
645 (native-inputs `(("python2-pip" ,python2-pip)))))
647 (define-public impressive
654 "mirror://sourceforge/impressive/Impressive/"
655 version "/Impressive-" version ".tar.gz"))
658 "0b3rmy6acp2vmf5nill3aknxvr9a5aawk1vnphkah61anxp62gsr"))))
659 (build-system python-build-system)
661 ;; TODO: Add dependency on pdftk.
662 (inputs `(("python-pygame" ,python-pygame)
663 ("python2-pillow" ,python2-pillow)
669 #:phases (modify-phases %standard-phases
674 (lambda* (#:key inputs outputs #:allow-other-keys)
675 ;; There's no 'setup.py' so install things manually.
676 (let* ((out (assoc-ref outputs "out"))
677 (bin (string-append out "/bin"))
678 (man1 (string-append out "/share/man/man1"))
679 (sdl (assoc-ref inputs "sdl"))
680 (xpdf (assoc-ref inputs "xpdf")))
682 (copy-file "impressive.py"
683 (string-append bin "/impressive"))
684 (wrap-program (string-append bin "/impressive")
685 `("LIBRARY_PATH" ":" prefix ;for ctypes
686 (,(string-append sdl "/lib")))
687 `("PATH" ":" prefix ;for pdftoppm
688 (,(string-append xpdf "/bin"))))
690 (install-file "impressive.1" man1)
692 (home-page "http://impressive.sourceforge.net")
693 (synopsis "PDF presentation tool with visual effects")
695 "Impressive is a tool to display PDF files that provides visual effects
696 such as smooth alpha-blended slide transitions. It provides additional tools
697 such as zooming, highlighting an area of the screen, and a tool to navigate
699 (license license:gpl2)))