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