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>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages pdf)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix utils)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system python)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages ghostscript)
39 #:use-module (gnu packages databases)
40 #:use-module (gnu packages djvu)
41 #:use-module (gnu packages gettext)
42 #:use-module (gnu packages backup)
43 #:use-module (gnu packages lesstif)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages qt)
47 #:use-module (gnu packages xorg)
48 #:use-module (gnu packages gnome)
49 #:use-module (gnu packages glib)
50 #:use-module (gnu packages gtk)
51 #:use-module (gnu packages lua)
52 #:use-module (gnu packages curl)
53 #:use-module (gnu packages pcre)
54 #:use-module (gnu packages perl)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages tls)
57 #:use-module (srfi srfi-1))
59 (define-public poppler
65 (uri (string-append "https://poppler.freedesktop.org/poppler-"
69 "0hnjkcqqk87dw3hlda4gh4l7brkslniax9a79g772jn3iwiffwmq"))))
70 (build-system gnu-build-system)
73 (inputs `(("fontconfig" ,fontconfig)
74 ("freetype" ,freetype)
79 ("openjpeg-1" ,openjpeg-1)
82 ;; To build poppler-glib (as needed by Evince), we need Cairo and
83 ;; GLib. But of course, that Cairo must not depend on Poppler.
84 ("cairo" ,(package (inherit cairo)
85 (inputs (alist-delete "poppler"
86 (package-inputs cairo)))))
89 `(("pkg-config" ,pkg-config)
90 ("glib" ,glib "bin") ; glib-mkenums, etc.
91 ("gobject-introspection" ,gobject-introspection)))
93 `(#:tests? #f ; no test data provided with the tarball
95 '("--enable-xpdf-headers" ; to install header files
98 ;; Saves 8 MiB of .a files.
101 (modify-phases %standard-phases
102 (add-before 'configure 'setenv
105 (string-append (assoc-ref %build-inputs "openjpeg-1")
106 "/include/openjpeg-1.5"
107 ":" (or (getenv "CPATH") ""))))))))
108 (synopsis "PDF rendering library")
110 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
111 (license license:gpl2+)
112 (home-page "https://poppler.freedesktop.org/")))
114 (define-public poppler-qt4
115 (package (inherit poppler)
117 (inputs `(("qt-4" ,qt-4)
118 ,@(package-inputs poppler)))
119 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
121 (define-public poppler-qt5
122 (package (inherit poppler)
124 (inputs `(("qtbase" ,qtbase)
125 ,@(package-inputs poppler)))
127 (substitute-keyword-arguments (package-arguments poppler)
128 ((#:configure-flags flags)
129 `(cons "CXXFLAGS=-std=gnu++11" ,flags))))
130 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
132 (define-public python-poppler-qt4
134 (name "python-poppler-qt4")
139 (uri (string-append "https://pypi.python.org/packages/source/p"
140 "/python-poppler-qt4/python-poppler-qt4-"
144 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
145 (build-system python-build-system)
148 (modify-phases %standard-phases
150 'unpack 'patch-poppler-include-paths
152 (substitute* (find-files "." "poppler-.*\\.sip")
153 (("qt4/poppler-.*\\.h" header)
154 (string-append "poppler/" header)))
157 `(("pkg-config" ,pkg-config)))
159 `(("python-sip" ,python-sip)
160 ("python-pyqt-4" ,python-pyqt-4)
161 ("poppler-qt4" ,poppler-qt4)))
162 (home-page "https://pypi.python.org/pypi/python-poppler-qt4")
163 (synopsis "Python bindings for Poppler-Qt4")
165 "This package provides Python bindings for the Qt4 interface of the
166 Poppler PDF rendering library.")
167 (license license:lgpl2.1+)))
169 (define-public libharu
175 (uri (string-append "https://github.com/libharu/libharu/archive/"
177 (string-join (string-split version #\.) "_")
179 (file-name (string-append name "-" version ".tar.gz"))
182 "1lm4v539y9cb1lvbq387j57sy7yxda3yv8b1pk8m6zazbp66i7lg"))))
183 (build-system gnu-build-system)
186 (list (string-append "--with-zlib="
187 (assoc-ref %build-inputs "zlib"))
188 (string-append "--with-png="
189 (assoc-ref %build-inputs "libpng")))
191 (modify-phases %standard-phases
192 (add-before 'configure 'autogen
193 (lambda _ (zero? (system* "autoreconf" "-vif")))))))
198 `(("autoconf" ,autoconf)
199 ("automake" ,automake)
200 ("libtool" ,libtool)))
201 (home-page "http://libharu.org/")
202 (synopsis "Library for generating PDF files")
204 "libHaru is a library for generating PDF files. libHaru does not support
205 reading and editing of existing PDF files.")
206 (license license:zlib)))
214 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
217 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
218 (build-system gnu-build-system)
219 (inputs `(("freetype" ,freetype)
220 ("gs-fonts" ,gs-fonts)
222 ("libpaper" ,libpaper)
231 `(#:tests? #f ; there is no check target
232 #:parallel-build? #f ; build fails randomly on 8-way machines
234 (list (string-append "--with-freetype2-includes="
235 (assoc-ref %build-inputs "freetype")
236 "/include/freetype2"))
240 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
241 (let* ((install (assoc-ref %standard-phases 'install))
242 (out (assoc-ref outputs "out"))
243 (xpdfrc (string-append out "/etc/xpdfrc"))
244 (gs-fonts (assoc-ref inputs "gs-fonts")))
247 (("/usr/local/share/ghostscript/fonts")
248 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
249 (("#fontFile") "fontFile"))))
251 (synopsis "Viewer for PDF files based on the Motif toolkit")
253 "Xpdf is a viewer for Portable Document Format (PDF) files.")
254 (license license:gpl3) ; or gpl2, but not gpl2+
255 (home-page "http://www.foolabs.com/xpdf/")))
257 (define-public zathura-cb
264 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
268 "1zbazysdjwwnzw01qlnzyixwmsi8rqskc76mp81qcr3rpl96jprp"))))
269 (native-inputs `(("pkg-config" ,pkg-config)))
270 (propagated-inputs `(("girara" ,girara)))
271 (inputs `(("libarchive" ,libarchive)
273 ("zathura" ,zathura)))
274 (build-system gnu-build-system)
276 `(#:make-flags (list (string-append "PREFIX=" %output)
277 (string-append "PLUGINDIR=" %output "/lib/zathura")
279 #:tests? #f ; Package does not contain tests.
281 (alist-delete 'configure %standard-phases)))
282 (home-page "https://pwmt.org/projects/zathura-cb/")
283 (synopsis "Comic book support for zathura (libarchive backend)")
284 (description "The zathura-cb plugin adds comic book support to zathura
286 (license license:zlib)))
288 (define-public zathura-ps
295 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
299 "18wsfy8pqficdgj8wy2aws7j4fy8z78157rhqk17mj5f295zgvm9"))))
300 (native-inputs `(("pkg-config" ,pkg-config)))
301 (propagated-inputs `(("girara" ,girara)))
302 (inputs `(("libspectre" ,libspectre)
304 ("zathura" ,zathura)))
305 (build-system gnu-build-system)
307 `(#:make-flags (list (string-append "PREFIX=" %output)
308 (string-append "PLUGINDIR=" %output "/lib/zathura")
310 #:tests? #f ; Package does not contain tests.
312 (alist-delete 'configure %standard-phases)))
313 (home-page "https://pwmt.org/projects/zathura-ps/")
314 (synopsis "PS support for zathura (libspectre backend)")
315 (description "The zathura-ps plugin adds PS support to zathura
317 (license license:zlib)))
319 (define-public zathura-djvu
321 (name "zathura-djvu")
326 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
330 "03cw54d2fipvbrnbqy0xccqkx6s77dyhyymx479aj5ryy4513dq8"))))
331 (native-inputs `(("pkg-config" ,pkg-config)))
332 (propagated-inputs `(("girara" ,girara)))
334 `(("djvulibre" ,djvulibre)
336 ("zathura" ,zathura)))
337 (build-system gnu-build-system)
339 `(#:make-flags (list (string-append "PREFIX=" %output)
340 (string-append "PLUGINDIR=" %output "/lib/zathura")
342 #:tests? #f ; Package does not contain tests.
344 (alist-delete 'configure %standard-phases)))
345 (home-page "https://pwmt.org/projects/zathura-djvu/")
346 (synopsis "DjVu support for zathura (DjVuLibre backend)")
347 (description "The zathura-djvu plugin adds DjVu support to zathura
348 using the DjVuLibre library.")
349 (license license:zlib)))
351 (define-public zathura-pdf-poppler
353 (name "zathura-pdf-poppler")
358 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
362 "1maqiv7yv8d8hymlffa688c5z71v85kbzmx2j88i8z349xx0rsyi"))))
363 (native-inputs `(("pkg-config" ,pkg-config)))
364 (propagated-inputs `(("girara" ,girara)))
366 `(("poppler" ,poppler)
370 (build-system gnu-build-system)
372 `(#:make-flags (list (string-append "PREFIX=" %output)
373 (string-append "PLUGINDIR=" %output "/lib/zathura")
375 #:tests? #f ; Package does not include tests.
377 (alist-delete 'configure %standard-phases)))
378 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
379 (synopsis "PDF support for zathura (poppler backend)")
380 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
381 by using the poppler rendering engine.")
382 (license license:zlib)))
384 (define-public zathura
391 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
395 "0fyb5hak0knqvg90rmdavwcmilhnrwgg1s5ykx9wd3skbpi8nsh8"))
396 (patches (search-patches
397 "zathura-plugindir-environment-variable.patch"))))
398 (native-inputs `(("pkg-config" ,pkg-config)
399 ("gettext" ,gnu-gettext)))
400 (inputs `(("girara" ,girara)
404 (list (search-path-specification
405 (variable "ZATHURA_PLUGIN_PATH")
406 (files '("lib/zathura")))))
407 (build-system gnu-build-system)
410 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
412 #:tests? #f ; Tests fail: "Gtk cannot open display".
415 (alist-delete 'configure %standard-phases)))
416 (home-page "https://pwmt.org/projects/zathura/")
417 (synopsis "Lightweight keyboard-driven PDF viewer")
418 (description "Zathura is a customizable document viewer. It provides a
419 minimalistic interface and an interface that mainly focuses on keyboard
421 (license license:zlib)))
423 (define-public podofo
429 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
430 "/podofo-" version ".tar.gz"))
433 "1n12lbq9x15vqn7dc0hsccp56l5jdff1xrhvlfqlbklxx0qiw9pc"))))
434 (build-system cmake-build-system)
435 (inputs ; TODO: Add cppunit for tests
439 ("fontconfig" ,fontconfig)
441 ("libjpeg" ,libjpeg-8)
442 ("freetype" ,freetype)
445 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
446 "-DPODOFO_BUILD_STATIC=ON")
450 (lambda* (#:key inputs #:allow-other-keys)
451 (let ((freetype (assoc-ref inputs "freetype")))
452 ;; Look for freetype include files in the correct place.
453 (substitute* "cmake/modules/FindFREETYPE.cmake"
454 (("/usr/local") freetype))))
456 (home-page "http://podofo.sourceforge.net")
457 (synopsis "Tools to work with the PDF file format")
459 "PoDoFo is a C++ library and set of command-line tools to work with the
460 PDF file format. It can parse PDF files and load them into memory, and makes
461 it easy to modify them and write the changes to disk. It is primarily useful
462 for applications that wish to do lower level manipulation of PDF, such as
463 extracting content or merging files.")
464 (license license:lgpl2.0+)))
473 (uri (string-append "http://mupdf.com/downloads/archive/"
474 name "-" version "-source.tar.gz"))
476 (base32 "01n26cy41lc2fjri63s4js23ixxb4nd37aafry3hz4i4id6wd8x2"))
477 (patches (search-patches "mupdf-CVE-2016-6265.patch"
478 "mupdf-CVE-2016-6525.patch"))
479 (modules '((guix build utils)))
481 ;; Don't build the bundled-in third party libraries.
482 '(delete-file-recursively "thirdparty"))))
483 (build-system gnu-build-system)
486 ("freetype" ,freetype)
487 ("jbig2dec" ,jbig2dec)
491 ("openjpeg" ,openjpeg-2.0)
495 `(("pkg-config" ,pkg-config)))
497 '(#:tests? #f ; no check target
498 #:make-flags (list "CC=gcc"
500 (string-append "prefix=" (assoc-ref %outputs "out")))
501 #:phases (modify-phases %standard-phases
502 (delete 'configure))))
503 (home-page "http://mupdf.com")
504 (synopsis "Lightweight PDF viewer and toolkit")
506 "MuPDF is a C library that implements a PDF and XPS parsing and
507 rendering engine. It is used primarily to render pages into bitmaps,
508 but also provides support for other operations such as searching and
509 listing the table of contents and hyperlinks.
511 The library ships with a rudimentary X11 viewer, and a set of command
512 line tools for batch rendering (pdfdraw), rewriting files (pdfclean),
513 and examining the file structure (pdfshow).")
514 (license license:agpl3+)))
522 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
523 "/qpdf-" version ".tar.gz"))
526 "0csj2p2gkxrc0rk8ykymlsdgfas96vzf1dip3y1x7z1q9plwgzd9"))
527 (modules '((guix build utils)))
529 ;; Replace shebang with the bi-lingual shell/Perl trick to remove
530 ;; dependency on Perl.
531 '(substitute* "qpdf/fix-qdf"
532 (("#!/usr/bin/env perl")
534 eval '(exit $?0)' && eval 'exec perl -wS \"$0\" ${1+\"$@\"}'
535 & eval 'exec perl -wS \"$0\" $argv:q'
537 (build-system gnu-build-system)
539 `(#:disallowed-references (,perl)
541 (modify-phases %standard-phases
542 (add-before 'configure 'patch-paths
544 (substitute* "make/libtool.mk"
546 (string-append "SHELL=" (which "bash"))))
548 '("qtest/bin/qtest-driver")
549 (find-files "." "\\.test"))
550 (("/usr/bin/env") (which "env"))))))))
552 `(("pkg-config" ,pkg-config)
558 (synopsis "Command-line tools and library for transforming PDF files")
560 "QPDF is a command-line program that does structural, content-preserving
561 transformations on PDF files. It could have been called something like
562 pdf-to-pdf. It includes support for merging and splitting PDFs and to
563 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
564 program capable of converting PDF into other formats.")
565 (license license:clarified-artistic)
566 (home-page "http://qpdf.sourceforge.net/")))
568 (define-public xournal
575 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
576 "/xournal-" version ".tar.gz"))
579 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
580 (build-system gnu-build-system)
586 ("libgnomecanvas" ,libgnomecanvas)))
588 `(("pkg-config" ,pkg-config)))
589 (home-page "http://xournal.sourceforge.net/")
590 (synopsis "Notetaking using a stylus")
592 "Xournal is an application for notetaking, sketching, keeping a journal
594 (license license:gpl2+)))
596 (define-public python-reportlab
598 (name "python-reportlab")
602 (uri (pypi-uri "reportlab" version))
605 "0rz2pg04wnzjjm2f5a8ik9v8s54mv4xrjhv5liqjijqv6awh12gl"))))
606 (build-system python-build-system)
608 ;; Prevent creation of the egg. Without this flag, various artifacts
609 ;; from the build inputs end up in the final python3 output. It also
610 ;; works around https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20765 .
611 `(#:configure-flags '("--single-version-externally-managed" "--root=/")))
613 `(("python-pillow" ,python-pillow)))
614 (home-page "http://www.reportlab.com")
615 (synopsis "Python library for generating PDFs and graphics")
616 (description "This is the ReportLab PDF Toolkit. It allows rapid creation
617 of rich PDF documents, and also creation of charts in a variety of bitmap and
619 (license license:bsd-3)
620 (properties `((python2-variant . ,(delay python2-reportlab))))))
622 (define-public python2-reportlab
624 (inherit (package-with-python2
625 (strip-python2-variant python-reportlab)))
626 (native-inputs `(("python2-pip" ,python2-pip)))))