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