gnu: poppler: Build against openjpeg@2.
[jackhill/guix/guix.git] / gnu / packages / pdf.scm
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, 2017 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Coypright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
10 ;;; Coypright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
11 ;;; Coypright © 2016 Julien Lepiller <julien@lepiller.eu>
12 ;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
13 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
14 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
15 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
16 ;;;
17 ;;; This file is part of GNU Guix.
18 ;;;
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
23 ;;;
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
28 ;;;
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32 (define-module (gnu packages pdf)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix utils)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system python)
40 #:use-module (guix build-system trivial)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages autotools)
43 #:use-module (gnu packages backup)
44 #:use-module (gnu packages base)
45 #:use-module (gnu packages bash)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages curl)
48 #:use-module (gnu packages databases)
49 #:use-module (gnu packages djvu)
50 #:use-module (gnu packages fontutils)
51 #:use-module (gnu packages game-development)
52 #:use-module (gnu packages gettext)
53 #:use-module (gnu packages ghostscript)
54 #:use-module (gnu packages gl)
55 #:use-module (gnu packages glib)
56 #:use-module (gnu packages gnome)
57 #:use-module (gnu packages gnupg)
58 #:use-module (gnu packages gtk)
59 #:use-module (gnu packages image)
60 #:use-module (gnu packages imagemagick)
61 #:use-module (gnu packages javascript)
62 #:use-module (gnu packages lesstif)
63 #:use-module (gnu packages linux)
64 #:use-module (gnu packages lua)
65 #:use-module (gnu packages pcre)
66 #:use-module (gnu packages perl)
67 #:use-module (gnu packages photo)
68 #:use-module (gnu packages pkg-config)
69 #:use-module (gnu packages python)
70 #:use-module (gnu packages qt)
71 #:use-module (gnu packages sdl)
72 #:use-module (gnu packages tls)
73 #:use-module (gnu packages xdisorg)
74 #:use-module (gnu packages xorg)
75 #:use-module (srfi srfi-1))
76
77 (define-public poppler
78 (package
79 (name "poppler")
80 (version "0.59.0")
81 (source (origin
82 (method url-fetch)
83 (uri (string-append "https://poppler.freedesktop.org/poppler-"
84 version ".tar.xz"))
85 (sha256
86 (base32
87 "0hcnghliyr8pr887qza18qfgaclw5jr889g1cjcglkni9jr2dmm3"))))
88 (build-system gnu-build-system)
89 ;; FIXME:
90 ;; use libcurl: no
91 (inputs `(("fontconfig" ,fontconfig)
92 ("freetype" ,freetype)
93 ("libjpeg" ,libjpeg)
94 ("libpng" ,libpng)
95 ("libtiff" ,libtiff)
96 ("lcms" ,lcms)
97 ("openjpeg" ,openjpeg)
98 ("zlib" ,zlib)
99
100 ;; To build poppler-glib (as needed by Evince), we need Cairo and
101 ;; GLib. But of course, that Cairo must not depend on Poppler.
102 ("cairo" ,(package (inherit cairo)
103 (inputs (alist-delete "poppler"
104 (package-inputs cairo)))))
105 ("glib" ,glib)))
106 (native-inputs
107 `(("pkg-config" ,pkg-config)
108 ("glib" ,glib "bin") ; glib-mkenums, etc.
109 ("gobject-introspection" ,gobject-introspection)))
110 (arguments
111 `(#:tests? #f ; no test data provided with the tarball
112 #:configure-flags
113 '("--enable-xpdf-headers" ; to install header files
114 "--enable-zlib"
115
116 ;; Saves 8 MiB of .a files.
117 "--disable-static")))
118 (synopsis "PDF rendering library")
119 (description
120 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
121 (license license:gpl2+)
122 (home-page "https://poppler.freedesktop.org/")))
123
124 (define-public poppler-qt4
125 (package (inherit poppler)
126 (name "poppler-qt4")
127 (inputs `(("qt-4" ,qt-4)
128 ,@(package-inputs poppler)))
129 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
130
131 (define-public poppler-qt5
132 (package (inherit poppler)
133 (name "poppler-qt5")
134 (inputs `(("qtbase" ,qtbase)
135 ,@(package-inputs poppler)))
136 (arguments
137 (substitute-keyword-arguments (package-arguments poppler)
138 ((#:configure-flags flags)
139 `(cons "CXXFLAGS=-std=gnu++11" ,flags))))
140 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
141
142 (define-public python-poppler-qt4
143 (package
144 (name "python-poppler-qt4")
145 (version "0.24.0")
146 (source
147 (origin
148 (method url-fetch)
149 (uri (string-append "https://pypi.python.org/packages/source/p"
150 "/python-poppler-qt4/python-poppler-qt4-"
151 version ".tar.gz"))
152 (sha256
153 (base32
154 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
155 (build-system python-build-system)
156 (arguments
157 `(#:phases
158 (modify-phases %standard-phases
159 (add-after
160 'unpack 'patch-poppler-include-paths
161 (lambda _
162 (substitute* (find-files "." "poppler-.*\\.sip")
163 (("qt4/poppler-.*\\.h" header)
164 (string-append "poppler/" header)))
165 #t)))))
166 (native-inputs
167 `(("pkg-config" ,pkg-config)))
168 (inputs
169 `(("python-sip" ,python-sip)
170 ("python-pyqt-4" ,python-pyqt-4)
171 ("poppler-qt4" ,poppler-qt4)))
172 (home-page "https://pypi.python.org/pypi/python-poppler-qt4")
173 (synopsis "Python bindings for Poppler-Qt4")
174 (description
175 "This package provides Python bindings for the Qt4 interface of the
176 Poppler PDF rendering library.")
177 (license license:lgpl2.1+)))
178
179 (define-public python-poppler-qt5
180 (package
181 (name "python-poppler-qt5")
182 (version "0.24.2")
183 (source
184 (origin
185 (method url-fetch)
186 (uri (pypi-uri "python-poppler-qt5" version))
187 (sha256
188 (base32
189 "0l69llw1fzwz8y90q0qp9q5pifbrqjjbwii7di54dwghw5fc6w1r"))))
190 (build-system python-build-system)
191 (arguments
192 `(;; There are no tests. The check phase just causes a rebuild.
193 #:tests? #f
194 #:phases
195 (modify-phases %standard-phases
196 (replace 'build
197 (lambda* (#:key inputs #:allow-other-keys)
198 (substitute* "setup.py"
199 ;; This check always fails, so disable it.
200 (("if not check_qtxml\\(\\)")
201 "if True")
202 ;; Enable C++11, which is needed because of Qt5.
203 (("\\*\\*ext_args" line)
204 (string-append "extra_compile_args=['-std=gnu++11'], " line)))
205 ;; We need to pass an extra flag here. This cannot be in
206 ;; configure-flags because it should not be passed for the
207 ;; installation phase.
208 ((@@ (guix build python-build-system) call-setuppy)
209 "build_ext" (list (string-append "--pyqt-sip-dir="
210 (assoc-ref inputs "python-pyqt")
211 "/share/sip")) #t))))))
212 (native-inputs
213 `(("pkg-config" ,pkg-config)))
214 (inputs
215 `(("python-sip" ,python-sip)
216 ("python-pyqt" ,python-pyqt)
217 ("poppler-qt5" ,poppler-qt5)
218 ("qtbase" ,qtbase)))
219 (home-page "https://pypi.python.org/pypi/python-poppler-qt5")
220 (synopsis "Python bindings for Poppler-Qt5")
221 (description
222 "This package provides Python bindings for the Qt5 interface of the
223 Poppler PDF rendering library.")
224 (license license:lgpl2.1+)))
225
226 (define-public libharu
227 (package
228 (name "libharu")
229 (version "2.3.0")
230 (source (origin
231 (method url-fetch)
232 (uri (string-append "https://github.com/libharu/libharu/archive/"
233 "RELEASE_"
234 (string-join (string-split version #\.) "_")
235 ".tar.gz"))
236 (file-name (string-append name "-" version ".tar.gz"))
237 (sha256
238 (base32
239 "1lm4v539y9cb1lvbq387j57sy7yxda3yv8b1pk8m6zazbp66i7lg"))))
240 (build-system gnu-build-system)
241 (arguments
242 `(#:configure-flags
243 (list (string-append "--with-zlib="
244 (assoc-ref %build-inputs "zlib"))
245 (string-append "--with-png="
246 (assoc-ref %build-inputs "libpng")))
247 #:phases
248 (modify-phases %standard-phases
249 (add-after 'unpack 'autogen
250 (lambda _ (zero? (system* "autoreconf" "-vif")))))))
251 (inputs
252 `(("zlib" ,zlib)
253 ("libpng" ,libpng)))
254 (native-inputs
255 `(("autoconf" ,autoconf)
256 ("automake" ,automake)
257 ("libtool" ,libtool)))
258 (home-page "http://libharu.org/")
259 (synopsis "Library for generating PDF files")
260 (description
261 "libHaru is a library for generating PDF files. libHaru does not support
262 reading and editing of existing PDF files.")
263 (license license:zlib)))
264
265 (define-public xpdf
266 (package
267 (name "xpdf")
268 (version "3.04")
269 (source (origin
270 (method url-fetch)
271 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
272 version ".tar.gz"))
273 (sha256 (base32
274 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
275 (build-system gnu-build-system)
276 (inputs `(("freetype" ,freetype)
277 ("gs-fonts" ,gs-fonts)
278 ("lesstif" ,lesstif)
279 ("libpaper" ,libpaper)
280 ("libx11" ,libx11)
281 ("libxext" ,libxext)
282 ("libxp" ,libxp)
283 ("libxpm" ,libxpm)
284 ("libxt" ,libxt)
285 ("libpng" ,libpng)
286 ("zlib" ,zlib)))
287 (arguments
288 `(#:tests? #f ; there is no check target
289 #:parallel-build? #f ; build fails randomly on 8-way machines
290 #:configure-flags
291 (list (string-append "--with-freetype2-includes="
292 (assoc-ref %build-inputs "freetype")
293 "/include/freetype2"))
294 #:phases
295 (modify-phases %standard-phases
296 (replace 'install
297 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
298 (let* ((install (assoc-ref %standard-phases 'install))
299 (out (assoc-ref outputs "out"))
300 (xpdfrc (string-append out "/etc/xpdfrc"))
301 (gs-fonts (assoc-ref inputs "gs-fonts")))
302 (apply install args)
303 (substitute* xpdfrc
304 (("/usr/local/share/ghostscript/fonts")
305 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
306 (("#fontFile") "fontFile")))
307 #t)))))
308 (synopsis "Viewer for PDF files based on the Motif toolkit")
309 (description
310 "Xpdf is a viewer for Portable Document Format (PDF) files.")
311 (license license:gpl3) ; or gpl2, but not gpl2+
312 (home-page "http://www.foolabs.com/xpdf/")))
313
314 (define-public zathura-cb
315 (package
316 (name "zathura-cb")
317 (version "0.1.6")
318 (source (origin
319 (method url-fetch)
320 (uri
321 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
322 version ".tar.gz"))
323 (sha256
324 (base32
325 "1fim4mpm8l2g3msj1vg70ks3c9lrwllv3yh4jv8l9f8k3r19b3l8"))))
326 (native-inputs `(("pkg-config" ,pkg-config)))
327 (propagated-inputs `(("girara" ,girara)))
328 (inputs `(("libarchive" ,libarchive)
329 ("gtk+" ,gtk+)
330 ("zathura" ,zathura)))
331 (build-system gnu-build-system)
332 (arguments
333 `(#:make-flags (list (string-append "PREFIX=" %output)
334 (string-append "PLUGINDIR=" %output "/lib/zathura")
335 "CC=gcc")
336 #:tests? #f ; Package does not contain tests.
337 #:phases
338 (modify-phases %standard-phases (delete 'configure))))
339 (home-page "https://pwmt.org/projects/zathura-cb/")
340 (synopsis "Comic book support for zathura (libarchive backend)")
341 (description "The zathura-cb plugin adds comic book support to zathura
342 using libarchive.")
343 (license license:zlib)))
344
345 (define-public zathura-ps
346 (package
347 (name "zathura-ps")
348 (version "0.2.4")
349 (source (origin
350 (method url-fetch)
351 (uri
352 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
353 version ".tar.gz"))
354 (sha256
355 (base32
356 "1nxbl0glnzpan78fhdfzhkcd0cikcvrkzf9m56mb0pvnwzlwg7zv"))))
357 (native-inputs `(("pkg-config" ,pkg-config)))
358 (propagated-inputs `(("girara" ,girara)))
359 (inputs `(("libspectre" ,libspectre)
360 ("gtk+" ,gtk+)
361 ("zathura" ,zathura)))
362 (build-system gnu-build-system)
363 (arguments
364 `(#:make-flags (list (string-append "PREFIX=" %output)
365 (string-append "PLUGINDIR=" %output "/lib/zathura")
366 "CC=gcc")
367 #:tests? #f ; Package does not contain tests.
368 #:phases
369 (modify-phases %standard-phases (delete 'configure))))
370 (home-page "https://pwmt.org/projects/zathura-ps/")
371 (synopsis "PS support for zathura (libspectre backend)")
372 (description "The zathura-ps plugin adds PS support to zathura
373 using libspectre.")
374 (license license:zlib)))
375
376 (define-public zathura-djvu
377 (package
378 (name "zathura-djvu")
379 (version "0.2.6")
380 (source (origin
381 (method url-fetch)
382 (uri
383 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
384 version ".tar.gz"))
385 (sha256
386 (base32
387 "0py0ra44f65cg064xzds0qr6vnglj2a5bwhnbwa0dyh2nyizdzmf"))))
388 (native-inputs `(("pkg-config" ,pkg-config)))
389 (propagated-inputs `(("girara" ,girara)))
390 (inputs
391 `(("djvulibre" ,djvulibre)
392 ("gtk+" ,gtk+)
393 ("zathura" ,zathura)))
394 (build-system gnu-build-system)
395 (arguments
396 `(#:make-flags (list (string-append "PREFIX=" %output)
397 (string-append "PLUGINDIR=" %output "/lib/zathura")
398 "CC=gcc")
399 #:tests? #f ; Package does not contain tests.
400 #:phases
401 (modify-phases %standard-phases (delete 'configure))))
402 (home-page "https://pwmt.org/projects/zathura-djvu/")
403 (synopsis "DjVu support for zathura (DjVuLibre backend)")
404 (description "The zathura-djvu plugin adds DjVu support to zathura
405 using the DjVuLibre library.")
406 (license license:zlib)))
407
408 (define-public zathura-pdf-mupdf
409 (package
410 (name "zathura-pdf-mupdf")
411 (version "0.3.1")
412 (source (origin
413 (method url-fetch)
414 (uri
415 (string-append "https://pwmt.org/projects/zathura-pdf-mupdf"
416 "/download/zathura-pdf-mupdf-" version ".tar.gz"))
417 (sha256
418 (base32
419 "06zqn8z6a0hfsx3s1kzqvqzb73afgcl6z5r062sxv7kv570fvffr"))))
420 (native-inputs `(("pkg-config" ,pkg-config)))
421 (propagated-inputs `(("girara" ,girara)))
422 (inputs
423 `(("gtk+" ,gtk+)
424 ("jbig2dec" ,jbig2dec)
425 ("libjpeg" ,libjpeg)
426 ("mupdf" ,mupdf)
427 ("openjpeg" ,openjpeg)
428 ("openssl" ,openssl)
429 ("zathura" ,zathura)))
430 (build-system gnu-build-system)
431 (arguments
432 `(#:make-flags (list (string-append "PREFIX=" %output)
433 (string-append "PLUGINDIR=" %output "/lib/zathura")
434 "CC=gcc")
435 #:tests? #f ;No tests.
436 #:phases (modify-phases %standard-phases (delete 'configure))))
437 (home-page "https://pwmt.org/projects/zathura-pdf-mupdf/")
438 (synopsis "PDF support for zathura (mupdf backend)")
439 (description "The zathura-pdf-mupdf plugin adds PDF support to zathura
440 by using the @code{mupdf} rendering library.")
441 (license license:zlib)))
442
443 (define-public zathura-pdf-poppler
444 (package
445 (name "zathura-pdf-poppler")
446 (version "0.2.7")
447 (source (origin
448 (method url-fetch)
449 (uri
450 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
451 version ".tar.gz"))
452 (sha256
453 (base32
454 "1h43sgxpsbrsnn5z19661642plzhpv6b0y3f4kyzshv1rr6lwplq"))))
455 (native-inputs `(("pkg-config" ,pkg-config)))
456 (propagated-inputs `(("girara" ,girara)))
457 (inputs
458 `(("poppler" ,poppler)
459 ("gtk+" ,gtk+)
460 ("zathura" ,zathura)
461 ("cairo" ,cairo)))
462 (build-system gnu-build-system)
463 (arguments
464 `(#:make-flags (list (string-append "PREFIX=" %output)
465 (string-append "PLUGINDIR=" %output "/lib/zathura")
466 "CC=gcc")
467 #:tests? #f ; Package does not include tests.
468 #:phases
469 (modify-phases %standard-phases (delete 'configure))))
470 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
471 (synopsis "PDF support for zathura (poppler backend)")
472 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
473 by using the poppler rendering engine.")
474 (license license:zlib)))
475
476 (define-public zathura
477 (package
478 (name "zathura")
479 (version "0.3.7")
480 (source (origin
481 (method url-fetch)
482 (uri
483 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
484 version ".tar.gz"))
485 (sha256
486 (base32
487 "1w0g74dq4z2vl3f99s2gkaqrb5pskgzig10qhbxj4gq9yj4zzbr2"))
488 (patches (search-patches
489 "zathura-plugindir-environment-variable.patch"))))
490 (native-inputs `(("pkg-config" ,pkg-config)
491 ("gettext" ,gettext-minimal)))
492 (inputs `(("girara" ,girara)
493 ("sqlite" ,sqlite)
494 ("gtk+" ,gtk+)))
495 (native-search-paths
496 (list (search-path-specification
497 (variable "ZATHURA_PLUGIN_PATH")
498 (files '("lib/zathura")))))
499 (build-system gnu-build-system)
500 (arguments
501 `(#:make-flags
502 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
503 "CC=gcc" "COLOR=0")
504 #:tests? #f ; Tests fail: "Gtk cannot open display".
505 #:test-target "test"
506 #:phases
507 (modify-phases %standard-phases (delete 'configure))))
508 (home-page "https://pwmt.org/projects/zathura/")
509 (synopsis "Lightweight keyboard-driven PDF viewer")
510 (description "Zathura is a customizable document viewer. It provides a
511 minimalistic interface and an interface that mainly focuses on keyboard
512 interaction.")
513 (license license:zlib)))
514
515 (define-public podofo
516 (package
517 (name "podofo")
518 (version "0.9.5")
519 (source (origin
520 (method url-fetch)
521 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
522 "/podofo-" version ".tar.gz"))
523 (sha256
524 (base32
525 "012kgfx5j5n6w4zkc1d290d2cwjk60jhzsjlr2x19g3yi75q2jc5"))))
526 (build-system cmake-build-system)
527 (inputs ; TODO: Add cppunit for tests
528 `(("lua" ,lua-5.1)
529 ("libpng" ,libpng)
530 ("openssl" ,openssl)
531 ("fontconfig" ,fontconfig)
532 ("libtiff" ,libtiff)
533 ("libjpeg" ,libjpeg-8)
534 ("freetype" ,freetype)
535 ("zlib" ,zlib)))
536 (arguments
537 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
538 "-DPODOFO_BUILD_STATIC=ON")
539 #:phases
540 (modify-phases %standard-phases
541 (add-before 'configure 'patch
542 (lambda* (#:key inputs #:allow-other-keys)
543 (let ((freetype (assoc-ref inputs "freetype")))
544 ;; Look for freetype include files in the correct place.
545 (substitute* "cmake/modules/FindFREETYPE.cmake"
546 (("/usr/local") freetype)))
547 #t)))))
548 (home-page "http://podofo.sourceforge.net")
549 (synopsis "Tools to work with the PDF file format")
550 (description
551 "PoDoFo is a C++ library and set of command-line tools to work with the
552 PDF file format. It can parse PDF files and load them into memory, and makes
553 it easy to modify them and write the changes to disk. It is primarily useful
554 for applications that wish to do lower level manipulation of PDF, such as
555 extracting content or merging files.")
556 (license license:lgpl2.0+)))
557
558 (define-public mupdf
559 (package
560 (name "mupdf")
561 (version "1.11")
562 (source
563 (origin
564 (method url-fetch)
565 (uri (string-append "https://mupdf.com/downloads/archive/"
566 name "-" version "-source.tar.gz"))
567 (sha256
568 (base32
569 "02phamcchgsmvjnb3ir7r5sssvx9fcrscn297z73b82n1jl79510"))
570 (patches (search-patches "mupdf-build-with-openjpeg-2.1.patch"
571 "mupdf-CVE-2017-14685.patch"
572 "mupdf-CVE-2017-14686.patch"
573 "mupdf-CVE-2017-14687.patch"
574 "mupdf-CVE-2017-15587.patch"))
575 (modules '((guix build utils)))
576 (snippet '(delete-file-recursively "thirdparty"))))
577 (build-system gnu-build-system)
578 (inputs
579 `(("curl" ,curl)
580 ("freetype" ,freetype)
581 ("harfbuzz" ,harfbuzz)
582 ("jbig2dec" ,jbig2dec)
583 ("libjpeg" ,libjpeg)
584 ("libx11" ,libx11)
585 ("libxext" ,libxext)
586 ("mujs" ,mujs)
587 ("openjpeg" ,openjpeg)
588 ("openssl" ,openssl)
589 ("zlib" ,zlib)))
590 (native-inputs
591 `(("pkg-config" ,pkg-config)))
592 (arguments
593 '(#:tests? #f ; no check target
594 #:make-flags (list "CC=gcc"
595 "XCFLAGS=-fpic"
596 (string-append "prefix=" (assoc-ref %outputs "out")))
597 #:phases (modify-phases %standard-phases
598 (delete 'configure))))
599 (home-page "https://mupdf.com")
600 (synopsis "Lightweight PDF viewer and toolkit")
601 (description
602 "MuPDF is a C library that implements a PDF and XPS parsing and
603 rendering engine. It is used primarily to render pages into bitmaps,
604 but also provides support for other operations such as searching and
605 listing the table of contents and hyperlinks.
606
607 The library ships with a rudimentary X11 viewer, and a set of command
608 line tools for batch rendering @command{pdfdraw}, rewriting files
609 @command{pdfclean}, and examining the file structure @command{pdfshow}.")
610 (license license:agpl3+)))
611
612 (define-public qpdf
613 (package
614 (name "qpdf")
615 (version "6.0.0")
616 (source (origin
617 (method url-fetch)
618 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
619 "/qpdf-" version ".tar.gz"))
620 (sha256
621 (base32
622 "0csj2p2gkxrc0rk8ykymlsdgfas96vzf1dip3y1x7z1q9plwgzd9"))
623 (modules '((guix build utils)))
624 (snippet
625 ;; Replace shebang with the bi-lingual shell/Perl trick to remove
626 ;; dependency on Perl.
627 '(substitute* "qpdf/fix-qdf"
628 (("#!/usr/bin/env perl")
629 "\
630 eval '(exit $?0)' && eval 'exec perl -wS \"$0\" ${1+\"$@\"}'
631 & eval 'exec perl -wS \"$0\" $argv:q'
632 if 0;\n")))))
633 (build-system gnu-build-system)
634 (arguments
635 `(#:disallowed-references (,perl)
636 #:phases
637 (modify-phases %standard-phases
638 (add-before 'configure 'patch-paths
639 (lambda _
640 (substitute* "make/libtool.mk"
641 (("SHELL=/bin/bash")
642 (string-append "SHELL=" (which "bash"))))
643 (substitute* (append
644 '("qtest/bin/qtest-driver")
645 (find-files "." "\\.test"))
646 (("/usr/bin/env") (which "env"))))))))
647 (native-inputs
648 `(("pkg-config" ,pkg-config)
649 ("perl" ,perl)))
650 (propagated-inputs
651 `(("pcre" ,pcre)))
652 (inputs
653 `(("zlib" ,zlib)))
654 (synopsis "Command-line tools and library for transforming PDF files")
655 (description
656 "QPDF is a command-line program that does structural, content-preserving
657 transformations on PDF files. It could have been called something like
658 pdf-to-pdf. It includes support for merging and splitting PDFs and to
659 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
660 program capable of converting PDF into other formats.")
661 (license license:clarified-artistic)
662 (home-page "http://qpdf.sourceforge.net/")))
663
664 (define-public xournal
665 (package
666 (name "xournal")
667 (version "0.4.8")
668 (source
669 (origin
670 (method url-fetch)
671 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
672 "/xournal-" version ".tar.gz"))
673 (sha256
674 (base32
675 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
676 (build-system gnu-build-system)
677 (inputs
678 `(("gtk" ,gtk+-2)
679 ("pango" ,pango)
680 ("poppler" ,poppler)
681 ("glib" ,glib)
682 ("libgnomecanvas" ,libgnomecanvas)))
683 (native-inputs
684 `(("pkg-config" ,pkg-config)))
685 (home-page "http://xournal.sourceforge.net/")
686 (synopsis "Notetaking using a stylus")
687 (description
688 "Xournal is an application for notetaking, sketching, keeping a journal
689 using a stylus.")
690 (license license:gpl2+)))
691
692 (define-public python-reportlab
693 (package
694 (name "python-reportlab")
695 (version "3.3.0")
696 (source (origin
697 (method url-fetch)
698 (uri (pypi-uri "reportlab" version))
699 (sha256
700 (base32
701 "0rz2pg04wnzjjm2f5a8ik9v8s54mv4xrjhv5liqjijqv6awh12gl"))))
702 (build-system python-build-system)
703 (arguments
704 '(;; FIXME: There is one test failure, but it does not cause the
705 ;; build to fail. No time to investigate right now.
706 #:test-target "tests"))
707 (propagated-inputs
708 `(("python-pillow" ,python-pillow)))
709 (home-page "http://www.reportlab.com")
710 (synopsis "Python library for generating PDFs and graphics")
711 (description "This is the ReportLab PDF Toolkit. It allows rapid creation
712 of rich PDF documents, and also creation of charts in a variety of bitmap and
713 vector formats.")
714 (license license:bsd-3)))
715
716 (define-public python2-reportlab
717 (package-with-python2 python-reportlab))
718
719 (define-public impressive
720 (package
721 (name "impressive")
722 (version "0.11.1")
723 (source (origin
724 (method url-fetch)
725 (uri (string-append
726 "mirror://sourceforge/impressive/Impressive/"
727 version "/Impressive-" version ".tar.gz"))
728 (sha256
729 (base32
730 "0b3rmy6acp2vmf5nill3aknxvr9a5aawk1vnphkah61anxp62gsr"))))
731 (build-system python-build-system)
732
733 ;; TODO: Add dependency on pdftk.
734 (inputs `(("python2-pygame" ,python2-pygame)
735 ("python2-pillow" ,python2-pillow)
736 ("sdl" ,sdl)
737 ("xpdf" ,xpdf)))
738
739 (arguments
740 `(#:python ,python-2
741 #:phases (modify-phases %standard-phases
742 (delete 'build)
743 (delete 'configure)
744 (delete 'check)
745 (replace 'install
746 (lambda* (#:key inputs outputs #:allow-other-keys)
747 ;; There's no 'setup.py' so install things manually.
748 (let* ((out (assoc-ref outputs "out"))
749 (bin (string-append out "/bin"))
750 (man1 (string-append out "/share/man/man1"))
751 (sdl (assoc-ref inputs "sdl"))
752 (xpdf (assoc-ref inputs "xpdf")))
753 (mkdir-p bin)
754 (copy-file "impressive.py"
755 (string-append bin "/impressive"))
756 (wrap-program (string-append bin "/impressive")
757 `("LIBRARY_PATH" ":" prefix ;for ctypes
758 (,(string-append sdl "/lib")))
759 `("PATH" ":" prefix ;for pdftoppm
760 (,(string-append xpdf "/bin"))))
761 (install-file "impressive.1" man1)
762 #t))))))
763 (home-page "http://impressive.sourceforge.net")
764 (synopsis "PDF presentation tool with visual effects")
765 (description
766 "Impressive is a tool to display PDF files that provides visual effects
767 such as smooth alpha-blended slide transitions. It provides additional tools
768 such as zooming, highlighting an area of the screen, and a tool to navigate
769 the PDF pages.")
770 (license license:gpl2)))
771
772 (define-public fbida
773 (package
774 (name "fbida")
775 (version "2.12")
776 (home-page "https://www.kraxel.org/blog/linux/fbida/")
777 (source (origin
778 (method url-fetch)
779 (uri (string-append "https://www.kraxel.org/releases/fbida/"
780 name "-" version ".tar.gz"))
781 (sha256
782 (base32
783 "0bw224vb7jh0lrqaf4jgxk48xglvxs674qcpj5y0axyfbh896cfk"))))
784 (build-system gnu-build-system)
785 (arguments
786 '(#:phases
787 (modify-phases %standard-phases
788 (add-after 'unpack 'patch-ldconfig
789 (lambda _
790 (substitute* "mk/Autoconf.mk"
791 (("/sbin/ldconfig -p") "echo lib")) #t))
792 (delete 'configure))
793 #:tests? #f
794 #:make-flags (list "CC=gcc"
795 (string-append "prefix=" (assoc-ref %outputs "out")))))
796 (inputs `(("libjpeg" ,libjpeg)
797 ("curl" ,curl)
798 ("libtiff" ,libtiff)
799 ("libudev" ,eudev)
800 ("libwebp" ,libwebp)
801 ("libdrm" ,libdrm)
802 ("imagemagick" ,imagemagick)
803 ("giflib" ,giflib)
804 ("glib" ,glib)
805 ("cairo-xcb" ,cairo-xcb)
806 ("freetype" ,freetype)
807 ("fontconfig" ,fontconfig)
808 ("libexif" ,libexif)
809 ("mesa" ,mesa)
810 ("libepoxy" ,libepoxy)
811 ("libpng" ,libpng)
812 ("poppler" ,poppler)))
813 (native-inputs `(("pkg-config" ,pkg-config)))
814 (synopsis "Framebuffer and drm-based image viewer")
815 (description
816 "fbida contains a few applications for viewing and editing images on
817 the framebuffer.")
818
819 (license license:gpl2+)))
820
821 (define-public pdf2svg
822 (package
823 (name "pdf2svg")
824 (version "0.2.3")
825 (source (origin
826 (method url-fetch)
827 (uri (string-append
828 "https://github.com/dawbarton/pdf2svg/archive/v"
829 version ".tar.gz"))
830 (file-name (string-append name "-" version ".tar.gz"))
831 (sha256
832 (base32
833 "12pa1pajirnlrkz2il3h4l30lc2prryk1qr132jk6z9y1c3qdcag"))))
834 (build-system gnu-build-system)
835 (inputs
836 `(("cairo" ,cairo)
837 ("poppler" ,poppler)))
838 (native-inputs
839 `(("pkg-config" ,pkg-config)))
840 (home-page "http://www.cityinthesky.co.uk/opensource/pdf2svg/")
841 (synopsis "PDF to SVG converter")
842 (description "@command{pdf2svg} is a simple command-line PDF to SVG
843 converter using the Poppler and Cairo libraries.")
844 (license license:gpl2+)))
845
846 (define-public python-pypdf2
847 (package
848 (name "python-pypdf2")
849 (version "1.26.0")
850 (source (origin
851 (method url-fetch)
852 (uri (pypi-uri "PyPDF2" version))
853 (sha256
854 (base32
855 "11a3aqljg4sawjijkvzhs3irpw0y67zivqpbjpm065ha5wpr13z2"))))
856 (build-system python-build-system)
857 (arguments
858 `(#:phases
859 (modify-phases %standard-phases
860 (add-after
861 'unpack 'patch-test-suite
862 (lambda _
863 ;; The text-file needs to be opened in binary mode for Python 3,
864 ;; so patch in the "b"
865 (substitute* "Tests/tests.py"
866 (("pdftext_file = open\\(.* 'crazyones.txt'\\), 'r" line)
867 (string-append line "b")))
868 #t))
869 (replace 'check
870 (lambda _
871 (zero? (system* "python" "-m" "unittest" "Tests.tests")))))))
872 (home-page "http://mstamy2.github.com/PyPDF2")
873 (synopsis "Pure Python PDF toolkit")
874 (description "PyPDF2 is a pure Python PDF library capable of:
875
876 @enumerate
877 @item extracting document information (title, author, …)
878 @item splitting documents page by page
879 @item merging documents page by page
880 @item cropping pages
881 @item merging multiple pages into a single page
882 @item encrypting and decrypting PDF files
883 @end enumerate
884
885 By being pure Python, it should run on any Python platform without any
886 dependencies on external libraries. It can also work entirely on
887 @code{StringIO} objects rather than file streams, allowing for PDF
888 manipulation in memory. It is therefore a useful tool for websites that
889 manage or manipulate PDFs.")
890 (license license:bsd-3)))
891
892 (define-public python2-pypdf2
893 (package-with-python2 python-pypdf2))
894
895 (define-public python2-pypdf
896 (package
897 (name "python2-pypdf")
898 (version "1.13")
899 (source (origin
900 (method url-fetch)
901 (uri (pypi-uri "pyPdf" version))
902 (sha256
903 (base32
904 "0fqfvamir7k41w84c73rghzkiv891gdr17q5iz4hgbf6r71y9v9s"))))
905 (build-system python-build-system)
906 (arguments
907 `(#:tests? #f ; no tests
908 #:python ,python-2))
909 (home-page "http://pybrary.net/pyPdf/")
910 (synopsis "Pure Python PDF toolkit")
911 (description "PyPDF2 is a pure Python PDF toolkit.
912
913 Note: This module isn't maintained anymore. For new projects please use
914 python-pypdf2 instead.")
915 (license license:bsd-3)))
916
917 (define-public pdfposter
918 (package
919 (name "pdfposter")
920 (version "0.6.0")
921 (source (origin
922 (method url-fetch)
923 (uri (pypi-uri "pdftools.pdfposter" version ".tar.bz2"))
924 (sha256
925 (base32
926 "1i9jqawf279va089ykicglcq4zlsnwgcnsdzaa8vnm836lqhywma"))))
927 (build-system python-build-system)
928 (arguments
929 `(#:tests? #f ; no test suite, only for visual control
930 #:python ,python-2))
931 (inputs
932 ;; pdfposter 0.6.0 still uses the old pyPdf
933 `(("python2-pypdf" ,python2-pypdf)))
934 (home-page "https://pythonhosted.org/pdftools.pdfposter/")
935 (synopsis "Scale and tile PDF images/pages to print on multiple pages")
936 (description "@command{pdfposter} can be used to create a large poster by
937 building it from multple pages and/or printing it on large media. It expects
938 as input a PDF file, normally printing on a single page. The output is again
939 a PDF file, maybe containing multiple pages together building the poster. The
940 input page will be scaled to obtain the desired size.
941
942 This is much like @command{poster} does for Postscript files, but working with
943 PDF. Since sometimes @command{poster} does not like your files converted from
944 PDF. Indeed @command{pdfposter} was inspired by @command{poster}.")
945 (license license:gpl3+)))
946
947 (define-public pdfgrep
948 (package
949 (name "pdfgrep")
950 (version "2.0.1")
951 (source
952 (origin
953 (method url-fetch)
954 (uri (string-append "https://pdfgrep.org/download/"
955 name "-" version ".tar.gz"))
956 (sha256
957 (base32
958 "07llkrkcfjwd3ybai9ad10ybhr0biffcplmy7lw4fb87nd2dfw03"))))
959 (build-system gnu-build-system)
960 (native-inputs
961 `(("pkg-config" ,pkg-config)))
962 (inputs
963 `(("libgcrypt" ,libgcrypt)
964 ("pcre" ,pcre)
965 ("poppler" ,poppler)))
966 (home-page "https://pdfgrep.org")
967 (synopsis "Command-line utility to search text in PDF files")
968 (description
969 "Pdfgrep searches in pdf files for strings matching a regular expression.
970 Support some GNU grep options as file name output, page number output,
971 optional case insensitivity, count occurrences, color highlights and search in
972 multiple files.")
973 (license license:gpl2+)))