pdf.scm 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566
  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, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
  5. ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
  6. ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
  7. ;;; Copyright © 2016 Nikita <nikita@n0.is>
  8. ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
  9. ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
  10. ;;; Copyright © 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
  11. ;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
  12. ;;; Copyright © 2016, 2019 Arun Isaac <arunisaac@systemreboot.net>
  13. ;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
  14. ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
  15. ;;; Copyright © 2017, 2018 Rene Saavedra <pacoon@protonmail.com>
  16. ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  17. ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
  18. ;;; Copyright © 2019 Ben Sturmfels <ben@sturm.com.au>
  19. ;;; Copyright © 2019,2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
  20. ;;; Copyright © 2020, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
  21. ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
  22. ;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
  23. ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  24. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  25. ;;;
  26. ;;; This file is part of GNU Guix.
  27. ;;;
  28. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  29. ;;; under the terms of the GNU General Public License as published by
  30. ;;; the Free Software Foundation; either version 3 of the License, or (at
  31. ;;; your option) any later version.
  32. ;;;
  33. ;;; GNU Guix is distributed in the hope that it will be useful, but
  34. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  35. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  36. ;;; GNU General Public License for more details.
  37. ;;;
  38. ;;; You should have received a copy of the GNU General Public License
  39. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  40. (define-module (gnu packages pdf)
  41. #:use-module ((guix licenses) #:prefix license:)
  42. #:use-module (guix packages)
  43. #:use-module (guix download)
  44. #:use-module (guix git-download)
  45. #:use-module (guix utils)
  46. #:use-module (guix build-system gnu)
  47. #:use-module (guix build-system cmake)
  48. #:use-module (guix build-system meson)
  49. #:use-module (guix build-system python)
  50. #:use-module (guix build-system qt)
  51. #:use-module (guix build-system trivial)
  52. #:use-module (gnu packages)
  53. #:use-module (gnu packages audio)
  54. #:use-module (gnu packages autotools)
  55. #:use-module (gnu packages backup)
  56. #:use-module (gnu packages base)
  57. #:use-module (gnu packages bash)
  58. #:use-module (gnu packages check)
  59. #:use-module (gnu packages compression)
  60. #:use-module (gnu packages cups)
  61. #:use-module (gnu packages curl)
  62. #:use-module (gnu packages djvu)
  63. #:use-module (gnu packages fonts)
  64. #:use-module (gnu packages fontutils)
  65. #:use-module (gnu packages game-development)
  66. #:use-module (gnu packages gcc)
  67. #:use-module (gnu packages gettext)
  68. #:use-module (gnu packages ghostscript)
  69. #:use-module (gnu packages gl)
  70. #:use-module (gnu packages glib)
  71. #:use-module (gnu packages gnome)
  72. #:use-module (gnu packages gnupg)
  73. #:use-module (gnu packages gstreamer)
  74. #:use-module (gnu packages gtk)
  75. #:use-module (gnu packages image)
  76. #:use-module (gnu packages javascript)
  77. #:use-module (gnu packages lesstif)
  78. #:use-module (gnu packages libffi)
  79. #:use-module (gnu packages linux)
  80. #:use-module (gnu packages lua)
  81. #:use-module (gnu packages man)
  82. #:use-module (gnu packages pcre)
  83. #:use-module (gnu packages perl)
  84. #:use-module (gnu packages photo)
  85. #:use-module (gnu packages pkg-config)
  86. #:use-module (gnu packages pulseaudio)
  87. #:use-module (gnu packages python)
  88. #:use-module (gnu packages python-check)
  89. #:use-module (gnu packages python-web)
  90. #:use-module (gnu packages python-xyz)
  91. #:use-module (gnu packages qt)
  92. #:use-module (gnu packages sdl)
  93. #:use-module (gnu packages sphinx)
  94. #:use-module (gnu packages sqlite)
  95. #:use-module (gnu packages tex)
  96. #:use-module (gnu packages time)
  97. #:use-module (gnu packages tcl)
  98. #:use-module (gnu packages tls)
  99. #:use-module (gnu packages web)
  100. #:use-module (gnu packages xdisorg)
  101. #:use-module (gnu packages xml)
  102. #:use-module (gnu packages xorg)
  103. #:use-module (srfi srfi-1))
  104. (define-public extractpdfmark
  105. (package
  106. (name "extractpdfmark")
  107. (version "1.1.0")
  108. (source
  109. (origin
  110. (method git-fetch)
  111. (uri (git-reference
  112. (url "https://github.com/trueroad/extractpdfmark")
  113. (commit (string-append "v" version))))
  114. (file-name (git-file-name name version))
  115. (sha256
  116. (base32 "14aa6zly53j8gx5d32caiabk2j4b102xha0v9149yahz6kbn5b80"))))
  117. (build-system gnu-build-system)
  118. (arguments
  119. `(#:phases
  120. (modify-phases %standard-phases
  121. (add-before 'check 'start-xorg-server
  122. ;; The test suite wants to write to /homeless-shelter
  123. (lambda _ (setenv "HOME" (getcwd)))))))
  124. (native-inputs
  125. `(("autoconf" ,autoconf)
  126. ("automake" ,automake)
  127. ("gettext" ,gettext-minimal)
  128. ("ghostscript" ,ghostscript)
  129. ("pkg-config" ,pkg-config)
  130. ("texlive" ,texlive-tiny)))
  131. (inputs
  132. `(("poppler" ,poppler)))
  133. (home-page "https://github.com/trueroad/extractpdfmark")
  134. (synopsis "Extract page mode and named destinations as PDFmark from PDF")
  135. (description
  136. "PDFmarks is a technique that accompanies PDF, and that is used to store
  137. metadata such as author or title, but also structural information such as
  138. bookmarks or hyperlinks.
  139. When Ghostscript reads the main PDF generated by the TeX system with embedded
  140. PDF files and outputs the final PDF, the PDF page mode and name targets
  141. etc. are not preserved. Therefore, when you open the final PDF, it is not
  142. displayed correctly. Also, remote PDF links do not work correctly.
  143. This program is able to extract the page mode and named targets as PDFmark
  144. from PDF. In this way, you can obtain embedded PDF files that have kept this
  145. information.")
  146. (license license:gpl3)))
  147. (define-public flyer-composer
  148. (package
  149. (name "flyer-composer")
  150. (version "1.0rc2")
  151. (source
  152. (origin
  153. (method url-fetch)
  154. (uri (pypi-uri "flyer-composer" version))
  155. (sha256
  156. (base32 "17igqb5dlcgcq4nimjw6cf9qgz6a728zdx1d0rr90r2z0llcchsv"))))
  157. (build-system python-build-system)
  158. (arguments
  159. `(#:tests? #f ;; TODO
  160. #:phases
  161. (modify-phases %standard-phases
  162. (add-after 'install 'wrap-executable
  163. (lambda* (#:key inputs outputs #:allow-other-keys)
  164. (let* ((out (assoc-ref outputs "out"))
  165. (qtbase (assoc-ref inputs "qtbase"))
  166. (qml "/lib/qt5/qml"))
  167. (wrap-program (string-append out "/bin/flyer-composer-gui")
  168. `("QT_PLUGIN_PATH" ":" =
  169. (,(string-append qtbase "/lib/qt5/plugins")))
  170. `("QT_QPA_PLATFORM_PLUGIN_PATH" ":" =
  171. (,(string-append qtbase "/lib/qt5/plugins/platforms"))))
  172. #t))))))
  173. (inputs
  174. `(("python-pypdf2" ,python-pypdf2)
  175. ("python-pyqt" ,python-pyqt)
  176. ("python-poppler-qt5" ,python-poppler-qt5)
  177. ("qtbase" ,qtbase-5)))
  178. (home-page "http://crazy-compilers.com/flyer-composer")
  179. (synopsis "Rearrange PDF pages to print as flyers on one sheet")
  180. (description "@command{flyer-composer} can be used to prepare one- or
  181. two-sided flyers for printing on one sheet of paper.
  182. Imagine you have designed a flyer in A6 format and want to print it using your
  183. A4 printer. Of course, you want to print four flyers on each sheet. This is
  184. where Flyer Composer steps in, creating a PDF which holds your flyer four
  185. times. If you have a second page, Flyer Composer can arrange it the same way
  186. - even if the second page is in a separate PDF file.
  187. This package contains both the command line tool and the gui too.")
  188. (license license:agpl3+)))
  189. (define-public flyer-composer-cli
  190. (package/inherit flyer-composer
  191. (name "flyer-composer-cli")
  192. (arguments
  193. `(#:tests? #f ;; TODO
  194. #:phases
  195. (modify-phases %standard-phases
  196. (add-after 'unpack 'remove-gui
  197. (lambda _
  198. (delete-file-recursively "flyer_composer/gui")
  199. (substitute* "setup.cfg"
  200. (("^\\s+flyer-composer-gui\\s*=.*") ""))
  201. #t)))))
  202. (inputs
  203. `(("python-pypdf2" ,python-pypdf2)))
  204. (description "@command{flyer-composer} can be used to prepare one- or
  205. two-sided flyers for printing on one sheet of paper.
  206. Imagine you have designed a flyer in A6 format and want to print it using your
  207. A4 printer. Of course, you want to print four flyers on each sheet. This is
  208. where Flyer Composer steps in, creating a PDF which holds your flyer four
  209. times. If you have a second page, Flyer Composer can arrange it the same way
  210. - even if the second page is in a separate PDF file.
  211. This package contains only the command line tool. If you like to use the gui,
  212. please install the @code{flyer-composer-gui} package.")))
  213. (define-public poppler
  214. (package
  215. (name "poppler")
  216. (version "21.07.0")
  217. (source (origin
  218. (method url-fetch)
  219. (uri (string-append "https://poppler.freedesktop.org/poppler-"
  220. version ".tar.xz"))
  221. (sha256
  222. (base32
  223. "1m54hsi8z6c13jdbjwz55flkra1mahmkw2igavbf8p86d2gv4sp2"))))
  224. (build-system cmake-build-system)
  225. ;; FIXME:
  226. ;; use libcurl: no
  227. (inputs `(("fontconfig" ,fontconfig)
  228. ("freetype" ,freetype)
  229. ("libjpeg" ,libjpeg-turbo)
  230. ("libpng" ,libpng)
  231. ("libtiff" ,libtiff)
  232. ("lcms" ,lcms)
  233. ("openjpeg" ,openjpeg)
  234. ("zlib" ,zlib)
  235. ;; To build poppler-glib (as needed by Evince), we need Cairo and
  236. ;; GLib. But of course, that Cairo must not depend on Poppler.
  237. ("cairo" ,cairo-sans-poppler)))
  238. (propagated-inputs
  239. ;; As per poppler-cairo and poppler-glib.pc.
  240. ;; XXX: Ideally we'd propagate Cairo too, but that would require a
  241. ;; different solution to the circular dependency mentioned above.
  242. `(("glib" ,glib)))
  243. (native-inputs
  244. `(("pkg-config" ,pkg-config)
  245. ("glib" ,glib "bin") ; glib-mkenums, etc.
  246. ("gobject-introspection" ,gobject-introspection)))
  247. (arguments
  248. `(#:tests? #f ;no test data provided with the tarball
  249. #:configure-flags
  250. (let* ((out (assoc-ref %outputs "out"))
  251. (lib (string-append out "/lib")))
  252. (list "-DENABLE_UNSTABLE_API_ABI_HEADERS=ON" ;to install header files
  253. "-DENABLE_ZLIB=ON"
  254. "-DENABLE_BOOST=OFF" ;disable Boost to save size
  255. (string-append "-DCMAKE_INSTALL_LIBDIR=" lib)
  256. (string-append "-DCMAKE_INSTALL_RPATH=" lib)))
  257. ,@(if (%current-target-system)
  258. `(#:phases
  259. (modify-phases %standard-phases
  260. (add-after 'unpack 'set-PKG_CONFIG
  261. (lambda _
  262. (setenv "PKG_CONFIG" ,(pkg-config-for-target))))))
  263. '())))
  264. (synopsis "PDF rendering library")
  265. (description
  266. "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
  267. (license license:gpl2+)
  268. (home-page "https://poppler.freedesktop.org/")))
  269. (define-public poppler-data
  270. (package
  271. (name "poppler-data")
  272. (version "0.4.10")
  273. (source (origin
  274. (method url-fetch)
  275. (uri (string-append "https://poppler.freedesktop.org/poppler-data"
  276. "-" version ".tar.gz"))
  277. (sha256
  278. (base32
  279. "0c3vjs3p7rjc4yfacnhd865r27czmzwcr4j2z4jldi68dvvcwbvf"))))
  280. (build-system gnu-build-system)
  281. (arguments
  282. '(#:tests? #f ; no test suite
  283. #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out")))
  284. #:phases
  285. (modify-phases %standard-phases
  286. ;; The package only provides some data files, so there is nothing to
  287. ;; build.
  288. (delete 'configure)
  289. (delete 'build))))
  290. (synopsis "Poppler encoding files for rendering of CJK and Cyrillic text")
  291. (description "This package provides optional encoding files for Poppler.
  292. When present, Poppler is able to correctly render CJK and Cyrillic text.")
  293. (home-page (package-home-page poppler))
  294. ;; See COPYING in the source distribution for more information about
  295. ;; the licensing.
  296. (license (list license:bsd-3
  297. license:gpl2))))
  298. (define-public poppler-qt5
  299. (package/inherit poppler
  300. (name "poppler-qt5")
  301. (inputs `(("qtbase" ,qtbase-5)
  302. ,@(package-inputs poppler)))
  303. (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
  304. (define-public python-poppler-qt5
  305. (package
  306. (name "python-poppler-qt5")
  307. (version "21.1.0")
  308. (source
  309. (origin
  310. (method url-fetch)
  311. (uri (pypi-uri "python-poppler-qt5" version))
  312. (sha256
  313. (base32
  314. "0b82gm4i75q5v19kfbq0h4y0b2vcwr2213zkhxh6l0h45kdndmxd"))))
  315. (build-system python-build-system)
  316. (arguments
  317. `(;; There are no tests. The check phase just causes a rebuild.
  318. #:tests? #f
  319. #:phases
  320. (modify-phases %standard-phases
  321. (replace 'build
  322. (lambda* (#:key inputs #:allow-other-keys)
  323. (substitute* "setup.py"
  324. ;; This check always fails, so disable it.
  325. (("if not check_qtxml\\(\\)")
  326. "if True"))
  327. ;; We need to pass an extra flag here. This cannot be in
  328. ;; configure-flags because it should not be passed for the
  329. ;; installation phase.
  330. ((@@ (guix build python-build-system) call-setuppy)
  331. "build_ext" (list (string-append "--pyqt-sip-dir="
  332. (assoc-ref inputs "python-pyqt")
  333. "/share/sip")) #t))))))
  334. (native-inputs
  335. `(("pkg-config" ,pkg-config)))
  336. (inputs
  337. `(("python-sip" ,python-sip-4)
  338. ("python-pyqt" ,python-pyqt)
  339. ("poppler-qt5" ,poppler-qt5)
  340. ("qtbase" ,qtbase-5)))
  341. (home-page "https://pypi.org/project/python-poppler-qt5/")
  342. (synopsis "Python bindings for Poppler-Qt5")
  343. (description
  344. "This package provides Python bindings for the Qt5 interface of the
  345. Poppler PDF rendering library.")
  346. (license license:lgpl2.1+)))
  347. (define-public libharu
  348. (package
  349. (name "libharu")
  350. (version "2.3.0")
  351. (source (origin
  352. (method git-fetch)
  353. (uri (git-reference
  354. (url "https://github.com/libharu/libharu")
  355. (commit (string-append
  356. "RELEASE_"
  357. (string-join (string-split version #\.) "_")))))
  358. (file-name (git-file-name name version))
  359. (sha256
  360. (base32
  361. "15s9hswnl3qqi7yh29jyrg0hma2n99haxznvcywmsp8kjqlyg75q"))))
  362. (build-system gnu-build-system)
  363. (arguments
  364. `(#:configure-flags
  365. (list (string-append "--with-zlib="
  366. (assoc-ref %build-inputs "zlib"))
  367. (string-append "--with-png="
  368. (assoc-ref %build-inputs "libpng")))))
  369. (inputs
  370. `(("zlib" ,zlib)
  371. ("libpng" ,libpng)))
  372. (native-inputs
  373. `(("autoconf" ,autoconf)
  374. ("automake" ,automake)
  375. ("libtool" ,libtool)))
  376. (home-page "http://libharu.org/")
  377. (synopsis "Library for generating PDF files")
  378. (description
  379. "libHaru is a library for generating PDF files. libHaru does not support
  380. reading and editing of existing PDF files.")
  381. (license license:zlib)))
  382. (define-public xpdf
  383. (package
  384. (name "xpdf")
  385. (version "4.03")
  386. (source
  387. (origin
  388. (method url-fetch)
  389. (uri (string-append "https://dl.xpdfreader.com/xpdf-" version ".tar.gz"))
  390. (sha256
  391. (base32 "0ip81c9vy0igjnasl9iv2lz214fb01vvvdzbvjmgwc63fi1jgr0g"))))
  392. (build-system cmake-build-system)
  393. (inputs `(("cups" ,cups)
  394. ("freetype" ,freetype)
  395. ("libpng" ,libpng)
  396. ("qtbase" ,qtbase-5)
  397. ("zlib" ,zlib)))
  398. (arguments
  399. `(#:tests? #f)) ; there is no check target
  400. (synopsis "Viewer for PDF files based on the Motif toolkit")
  401. (description
  402. "Xpdf is a viewer for Portable Document Format (PDF) files.")
  403. (license license:gpl3) ; or gpl2, but not gpl2+
  404. (home-page "https://www.xpdfreader.com/")))
  405. (define-public zathura-cb
  406. (package
  407. (name "zathura-cb")
  408. (version "0.1.8")
  409. (source (origin
  410. (method url-fetch)
  411. (uri
  412. (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
  413. version ".tar.xz"))
  414. (sha256
  415. (base32
  416. "1i6cf0vks501cggwvfsl6qb7mdaf3sszdymphimfvnspw810faj5"))))
  417. (native-inputs `(("pkg-config" ,pkg-config)))
  418. (inputs `(("libarchive" ,libarchive)
  419. ("zathura" ,zathura)))
  420. (build-system meson-build-system)
  421. (arguments
  422. `(#:tests? #f ; package does not contain tests
  423. #:phases
  424. (modify-phases %standard-phases
  425. (add-after 'unpack 'patch-plugin-directory
  426. ;; Something of a regression in 0.1.8: the new Meson build system
  427. ;; now hard-codes an incorrect plugin directory. Fix it.
  428. (lambda* (#:key outputs #:allow-other-keys)
  429. (substitute* "meson.build"
  430. (("(install_dir:).*" _ key)
  431. (string-append key
  432. "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
  433. #t)))))
  434. (home-page "https://pwmt.org/projects/zathura-cb/")
  435. (synopsis "Comic book support for zathura (libarchive backend)")
  436. (description "The zathura-cb plugin adds comic book support to zathura
  437. using libarchive.")
  438. (license license:zlib)))
  439. (define-public zathura-ps
  440. (package
  441. (name "zathura-ps")
  442. (version "0.2.6")
  443. (source (origin
  444. (method url-fetch)
  445. (uri
  446. (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
  447. version ".tar.xz"))
  448. (sha256
  449. (base32
  450. "0wygq89nyjrjnsq7vbpidqdsirjm6iq4w2rijzwpk2f83ys8bc3y"))))
  451. (native-inputs `(("pkg-config" ,pkg-config)))
  452. (inputs `(("libspectre" ,libspectre)
  453. ("zathura" ,zathura)))
  454. (build-system meson-build-system)
  455. (arguments
  456. `(#:tests? #f ; package does not contain tests
  457. #:phases
  458. (modify-phases %standard-phases
  459. (add-after 'unpack 'patch-plugin-directory
  460. ;; Something of a regression in 0.2.6: the new Meson build system
  461. ;; now hard-codes an incorrect plugin directory. Fix it.
  462. (lambda* (#:key outputs #:allow-other-keys)
  463. (substitute* "meson.build"
  464. (("(install_dir:).*" _ key)
  465. (string-append key
  466. "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
  467. #t)))))
  468. (home-page "https://pwmt.org/projects/zathura-ps/")
  469. (synopsis "PS support for zathura (libspectre backend)")
  470. (description "The zathura-ps plugin adds PS support to zathura
  471. using libspectre.")
  472. (license license:zlib)))
  473. (define-public zathura-djvu
  474. (package
  475. (name "zathura-djvu")
  476. (version "0.2.9")
  477. (source (origin
  478. (method url-fetch)
  479. (uri
  480. (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
  481. version ".tar.xz"))
  482. (sha256
  483. (base32
  484. "0062n236414db7q7pnn3ccg5111ghxj3407pn9ri08skxskgirln"))))
  485. (native-inputs `(("pkg-config" ,pkg-config)))
  486. (inputs
  487. `(("djvulibre" ,djvulibre)
  488. ("zathura" ,zathura)))
  489. (build-system meson-build-system)
  490. (arguments
  491. `(#:tests? #f ; package does not contain tests
  492. #:phases
  493. (modify-phases %standard-phases
  494. (add-after 'unpack 'patch-plugin-directory
  495. ;; Something of a regression in 0.2.8: the new Meson build system
  496. ;; now hard-codes an incorrect plugin directory. Fix it.
  497. (lambda* (#:key outputs #:allow-other-keys)
  498. (substitute* "meson.build"
  499. (("(install_dir:).*" _ key)
  500. (string-append key
  501. "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
  502. #t)))))
  503. (home-page "https://pwmt.org/projects/zathura-djvu/")
  504. (synopsis "DjVu support for zathura (DjVuLibre backend)")
  505. (description "The zathura-djvu plugin adds DjVu support to zathura
  506. using the DjVuLibre library.")
  507. (license license:zlib)))
  508. (define-public zathura-pdf-mupdf
  509. (package
  510. (name "zathura-pdf-mupdf")
  511. (version "0.3.6")
  512. (source (origin
  513. (method url-fetch)
  514. (uri
  515. (string-append "https://pwmt.org/projects/zathura-pdf-mupdf"
  516. "/download/zathura-pdf-mupdf-" version ".tar.xz"))
  517. (sha256
  518. (base32
  519. "1r3v37k9fl2rxipvacgxr36llywvy7n20a25h3ajlyk70697sa66"))))
  520. (native-inputs `(("pkg-config" ,pkg-config)))
  521. (inputs
  522. `(("jbig2dec" ,jbig2dec)
  523. ("libjpeg" ,libjpeg-turbo)
  524. ("mujs" ,mujs)
  525. ("mupdf" ,mupdf)
  526. ("openjpeg" ,openjpeg)
  527. ("openssl" ,openssl)
  528. ("zathura" ,zathura)))
  529. (build-system meson-build-system)
  530. (arguments
  531. `(#:tests? #f ; package does not contain tests
  532. #:configure-flags (list (string-append "-Dplugindir="
  533. (assoc-ref %outputs "out")
  534. "/lib/zathura")
  535. "-Dlink-external=true")
  536. #:phases
  537. (modify-phases %standard-phases
  538. (add-after 'unpack 'remove-libmupdfthird.a-requirement
  539. (lambda _
  540. ;; Ignore a missing (apparently superfluous) static library.
  541. (substitute* "meson.build"
  542. ((".*mupdfthird.*") ""))
  543. #t))
  544. (add-before 'configure 'add-mujs-to-dependencies
  545. (lambda _
  546. ;; Add mujs to the 'build_dependencies'.
  547. (substitute* "meson.build"
  548. (("^ libopenjp2 = dependency.*" x)
  549. (string-append x " mujs = cc.find_library('mujs')\n"))
  550. (("^ libopenjp2")
  551. " libopenjp2, mujs")))))))
  552. (home-page "https://pwmt.org/projects/zathura-pdf-mupdf/")
  553. (synopsis "PDF support for zathura (mupdf backend)")
  554. (description "The zathura-pdf-mupdf plugin adds PDF support to zathura
  555. by using the @code{mupdf} rendering library.")
  556. (license license:zlib)))
  557. (define-public zathura-pdf-poppler
  558. (package
  559. (name "zathura-pdf-poppler")
  560. (version "0.3.0")
  561. (source (origin
  562. (method url-fetch)
  563. (uri
  564. (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
  565. version ".tar.xz"))
  566. (sha256
  567. (base32
  568. "1vfl4vkyy3rf39r1sqaa7y8113bgkh2bkfq3nn2inis9mrykmk6m"))))
  569. (native-inputs `(("pkg-config" ,pkg-config)))
  570. (inputs
  571. `(("poppler" ,poppler)
  572. ("zathura" ,zathura)))
  573. (build-system meson-build-system)
  574. (arguments
  575. `(#:tests? #f ; package does not include tests
  576. #:phases
  577. (modify-phases %standard-phases
  578. (add-after 'unpack 'patch-plugin-directory
  579. ;; Something of a regression in 0.2.9: the new Meson build system
  580. ;; now hard-codes an incorrect plugin directory. Fix it.
  581. (lambda* (#:key outputs #:allow-other-keys)
  582. (substitute* "meson.build"
  583. (("(install_dir:).*" _ key)
  584. (string-append key
  585. "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
  586. #t)))))
  587. (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
  588. (synopsis "PDF support for zathura (poppler backend)")
  589. (description "The zathura-pdf-poppler plugin adds PDF support to zathura
  590. by using the poppler rendering engine.")
  591. (license license:zlib)))
  592. (define-public zathura
  593. (package
  594. (name "zathura")
  595. (version "0.4.8")
  596. (source (origin
  597. (method url-fetch)
  598. (uri
  599. (string-append "https://pwmt.org/projects/zathura/download/zathura-"
  600. version ".tar.xz"))
  601. (sha256
  602. (base32
  603. "1nr0ym1mi2afk4ycdf1ppmkcv7i7hyzwn4p3r4m0j2qm3nvaiami"))))
  604. (native-inputs `(("pkg-config" ,pkg-config)
  605. ("gettext" ,gettext-minimal)
  606. ("glib:bin" ,glib "bin")
  607. ;; For building documentation.
  608. ("python-sphinx" ,python-sphinx)
  609. ;; For building icons.
  610. ("librsvg" ,librsvg)
  611. ;; For tests.
  612. ("check" ,check)
  613. ("xorg-server" ,xorg-server-for-tests)))
  614. (inputs `(("sqlite" ,sqlite)))
  615. ;; Listed in 'Requires.private' of 'zathura.pc'.
  616. (propagated-inputs `(("cairo" ,cairo)
  617. ("girara" ,girara)))
  618. (native-search-paths
  619. (list (search-path-specification
  620. (variable "ZATHURA_PLUGINS_PATH")
  621. (files '("lib/zathura")))))
  622. (build-system meson-build-system)
  623. (arguments
  624. `(#:phases (modify-phases %standard-phases
  625. (add-before 'check 'start-xserver
  626. ;; Tests require a running X server.
  627. (lambda* (#:key inputs #:allow-other-keys)
  628. (let ((xorg-server (assoc-ref inputs "xorg-server"))
  629. (display ":1"))
  630. (setenv "DISPLAY" display)
  631. ;; On busy machines, tests may take longer than
  632. ;; the default of four seconds.
  633. (setenv "CK_DEFAULT_TIMEOUT" "20")
  634. ;; Don't fail due to missing '/etc/machine-id'.
  635. (setenv "DBUS_FATAL_WARNINGS" "0")
  636. (zero? (system (string-append xorg-server "/bin/Xvfb "
  637. display " &")))))))))
  638. (home-page "https://pwmt.org/projects/zathura/")
  639. (synopsis "Lightweight keyboard-driven PDF viewer")
  640. (description "Zathura is a customizable document viewer. It provides a
  641. minimalistic interface and an interface that mainly focuses on keyboard
  642. interaction.")
  643. (license license:zlib)))
  644. (define-public podofo
  645. (package
  646. (name "podofo")
  647. (version "0.9.7")
  648. (source (origin
  649. (method url-fetch)
  650. (uri (string-append "mirror://sourceforge/podofo/podofo/" version
  651. "/podofo-" version ".tar.gz"))
  652. (sha256
  653. (base32
  654. "1f0yvkx6nf99fp741w2y706d8bs9824x1z2gqm3rdy5fv8bfgwkw"))))
  655. (build-system cmake-build-system)
  656. (native-inputs
  657. `(("cppunit" ,cppunit)
  658. ("pkg-config" ,pkg-config)))
  659. (inputs
  660. `(("libjpeg" ,libjpeg-turbo)
  661. ("libtiff" ,libtiff)
  662. ("fontconfig" ,fontconfig)
  663. ("freetype" ,freetype)
  664. ("libpng" ,libpng)
  665. ("lua" ,lua-5.1)
  666. ("openssl" ,openssl)
  667. ("zlib" ,zlib)))
  668. (arguments
  669. `(#:configure-flags
  670. (list "-DPODOFO_BUILD_SHARED=ON")
  671. #:phases
  672. (modify-phases %standard-phases
  673. (add-before 'configure 'patch
  674. (lambda* (#:key inputs #:allow-other-keys)
  675. (let ((freetype (assoc-ref inputs "freetype")))
  676. ;; Look for freetype include files in the correct place.
  677. (substitute* "cmake/modules/FindFREETYPE.cmake"
  678. (("/usr/local") freetype)))
  679. #t)))))
  680. (home-page "http://podofo.sourceforge.net")
  681. (synopsis "Tools to work with the PDF file format")
  682. (description
  683. "PoDoFo is a C++ library and set of command-line tools to work with the
  684. PDF file format. It can parse PDF files and load them into memory, and makes
  685. it easy to modify them and write the changes to disk. It is primarily useful
  686. for applications that wish to do lower level manipulation of PDF, such as
  687. extracting content or merging files.")
  688. (license license:lgpl2.0+)))
  689. (define-public mupdf
  690. (package
  691. (name "mupdf")
  692. (version "1.18.0")
  693. (source
  694. (origin
  695. (method url-fetch)
  696. (uri (string-append "https://mupdf.com/downloads/archive/"
  697. "mupdf-" version "-source.tar.xz"))
  698. (sha256
  699. (base32 "16m5sksil22sshxy70xkslsb2qhvcqb1d95i9savnhds1xn4ybar"))
  700. (patches (search-patches "mupdf-fix-linkage.patch"
  701. "mupdf-CVE-2021-3407.patch"))
  702. (modules '((guix build utils)))
  703. (snippet
  704. '(begin
  705. ;; Remove bundled software.
  706. (let* ((keep (list "lcms2")) ; different from our lcms2 package
  707. (from "thirdparty")
  708. (kept (string-append from "~temp")))
  709. (mkdir-p kept)
  710. (for-each (lambda (file) (rename-file (string-append from "/" file)
  711. (string-append kept "/" file)))
  712. keep)
  713. (delete-file-recursively from)
  714. (rename-file kept from))
  715. #t))))
  716. (build-system gnu-build-system)
  717. (inputs
  718. `(("curl" ,curl)
  719. ("freeglut" ,freeglut)
  720. ("freetype" ,freetype)
  721. ("gumbo-parser" ,gumbo-parser)
  722. ("harfbuzz" ,harfbuzz)
  723. ("jbig2dec" ,jbig2dec)
  724. ("libjpeg" ,libjpeg-turbo)
  725. ("libx11" ,libx11)
  726. ("libxext" ,libxext)
  727. ("mujs" ,mujs)
  728. ("openjpeg" ,openjpeg)
  729. ("openssl" ,openssl)
  730. ("zlib" ,zlib)))
  731. (native-inputs
  732. `(("pkg-config" ,pkg-config)))
  733. (arguments
  734. `(#:tests? #f ; no check target
  735. #:make-flags (list "verbose=yes"
  736. (string-append "CC=" ,(cc-for-target))
  737. "XCFLAGS=-fpic"
  738. "USE_SYSTEM_LIBS=yes"
  739. "USE_SYSTEM_MUJS=yes"
  740. "shared=yes"
  741. ;; Even with the linkage patch we must fix RUNPATH.
  742. (string-append "LDFLAGS=-Wl,-rpath="
  743. (assoc-ref %outputs "out") "/lib")
  744. (string-append "prefix=" (assoc-ref %outputs "out")))
  745. #:phases (modify-phases %standard-phases
  746. (delete 'configure)))) ; no configure script
  747. (home-page "https://mupdf.com")
  748. (synopsis "Lightweight PDF viewer and toolkit")
  749. (description
  750. "MuPDF is a C library that implements a PDF and XPS parsing and
  751. rendering engine. It is used primarily to render pages into bitmaps,
  752. but also provides support for other operations such as searching and
  753. listing the table of contents and hyperlinks.
  754. The library ships with a rudimentary X11 viewer, and a set of command
  755. line tools for batch rendering @command{pdfdraw}, rewriting files
  756. @command{pdfclean}, and examining the file structure @command{pdfshow}.")
  757. (license (list license:agpl3+
  758. license:bsd-3 ; resources/cmaps
  759. license:x11 ; thirdparty/lcms2
  760. license:silofl1.1 ; resources/fonts/{han,noto,sil,urw}
  761. license:asl2.0)))) ; resources/fonts/droid
  762. (define-public qpdf
  763. (package
  764. (name "qpdf")
  765. (version "10.0.1")
  766. (source (origin
  767. (method url-fetch)
  768. (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
  769. "/qpdf-" version ".tar.gz"))
  770. (sha256
  771. (base32
  772. "0yw2cpw7ygfd6jlgpwbi8vsnvv9p55zxp9h17x77z2qq733pf8jx"))))
  773. (build-system gnu-build-system)
  774. (arguments
  775. `(#:disallowed-references (,perl)
  776. #:phases
  777. (modify-phases %standard-phases
  778. (add-before 'configure 'patch-paths
  779. (lambda _
  780. (substitute* "make/libtool.mk"
  781. (("SHELL=/bin/bash")
  782. (string-append "SHELL=" (which "bash"))))
  783. (substitute* (append
  784. '("qtest/bin/qtest-driver")
  785. (find-files "." "\\.test"))
  786. (("/usr/bin/env") (which "env")))
  787. #t)))))
  788. (native-inputs
  789. `(("pkg-config" ,pkg-config)
  790. ("perl" ,perl)))
  791. (propagated-inputs
  792. ;; In Requires.private of libqpdf.pc.
  793. `(("libjpeg-turbo" ,libjpeg-turbo)
  794. ("zlib" ,zlib)))
  795. (synopsis "Command-line tools and library for transforming PDF files")
  796. (description
  797. "QPDF is a command-line program that does structural, content-preserving
  798. transformations on PDF files. It could have been called something like
  799. pdf-to-pdf. It includes support for merging and splitting PDFs and to
  800. manipulate the list of pages in a PDF file. It is not a PDF viewer or a
  801. program capable of converting PDF into other formats.")
  802. ;; Prior to the 7.0 release, QPDF was licensed under Artistic 2.0.
  803. ;; Users can still choose to use the old license at their option.
  804. (license (list license:asl2.0 license:clarified-artistic))
  805. (home-page "http://qpdf.sourceforge.net/")))
  806. (define-public qpdfview
  807. (package
  808. (name "qpdfview")
  809. (version "0.4.18")
  810. (source
  811. (origin
  812. (method url-fetch)
  813. (uri (string-append "https://launchpad.net/qpdfview/"
  814. "trunk/" version "/+download/"
  815. "qpdfview-" version ".tar.gz"))
  816. (sha256
  817. (base32 "0v1rl126hvblajnph2hkansgi0s8vjdc5yxrm4y3faa0lxzjwr6c"))
  818. (patches (search-patches "qpdfview-qt515-compat.patch"))))
  819. (build-system qt-build-system)
  820. (native-inputs
  821. `(("pkg-config" ,pkg-config)))
  822. (inputs
  823. `(("cups" ,cups)
  824. ("djvulibre" ,djvulibre)
  825. ("libspectre" ,libspectre)
  826. ("poppler-qt5" ,poppler-qt5)
  827. ("qtbase" ,qtbase-5)
  828. ("qtsvg" ,qtsvg)))
  829. (arguments
  830. `(#:tests? #f ; no tests
  831. #:phases
  832. (modify-phases %standard-phases
  833. (replace 'configure
  834. (lambda _
  835. (substitute* "qpdfview.pri"
  836. (("/usr") (assoc-ref %outputs "out")))
  837. (invoke "qmake" "qpdfview.pro"))))))
  838. (home-page "https://launchpad.net/qpdfview")
  839. (synopsis "Tabbed document viewer")
  840. (description "@command{qpdfview} is a document viewer for PDF, PS and DJVU
  841. files. It uses the Qt toolkit and features persistent per-file settings,
  842. configurable toolbars and shortcuts, continuous and multi‐page layouts,
  843. SyncTeX support, and rudimentary support for annotations and forms.")
  844. (license license:gpl2+)))
  845. (define-public xournal
  846. (package
  847. (name "xournal")
  848. (version "0.4.8.2016")
  849. (source
  850. (origin
  851. (method url-fetch)
  852. (uri (string-append "mirror://sourceforge/xournal/xournal/" version
  853. "/xournal-" version ".tar.gz"))
  854. (sha256
  855. (base32
  856. "09i88v3wacmx7f96dmq0l3afpyv95lh6jrx16xzm0jd1szdrhn5j"))))
  857. (build-system gnu-build-system)
  858. (inputs
  859. `(("gtk" ,gtk+-2)
  860. ("pango" ,pango)
  861. ("poppler" ,poppler)
  862. ("glib" ,glib)
  863. ("libgnomecanvas" ,libgnomecanvas)))
  864. (native-inputs
  865. `(("pkg-config" ,pkg-config)))
  866. (home-page "http://xournal.sourceforge.net/")
  867. (synopsis "Notetaking using a stylus")
  868. (description
  869. "Xournal is an application for notetaking, sketching, keeping a journal
  870. using a stylus.")
  871. (license license:gpl2+)))
  872. (define-public xournalpp
  873. (package
  874. (name "xournalpp")
  875. (version "1.1.0")
  876. (source
  877. (origin
  878. (method git-fetch)
  879. (uri (git-reference
  880. (url "https://github.com/xournalpp/xournalpp")
  881. (commit version)))
  882. (file-name (git-file-name name version))
  883. (sha256
  884. (base32 "0ldf58l5sqy52x5dqfpdjdh7ldjilj9mw42jzsl5paxg0md2k0hl"))))
  885. (build-system cmake-build-system)
  886. (arguments
  887. `(#:configure-flags (list "-DENABLE_CPPUNIT=ON") ;enable tests
  888. #:imported-modules ((guix build glib-or-gtk-build-system)
  889. ,@%cmake-build-system-modules)
  890. #:modules (((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
  891. (guix build cmake-build-system)
  892. (guix build utils))
  893. #:phases
  894. (modify-phases %standard-phases
  895. (add-after 'unpack 'fix-permissions-on-po-files
  896. (lambda _
  897. ;; Make sure 'msgmerge' can modify the PO files.
  898. (for-each make-file-writable
  899. (find-files "." "\\.po$"))))
  900. ;; Fix path to addr2line utility, which the crash reporter uses.
  901. (add-after 'unpack 'fix-paths
  902. (lambda* (#:key inputs #:allow-other-keys)
  903. (substitute* "src/util/Stacktrace.cpp"
  904. ;; Match only the commandline.
  905. (("\"addr2line ")
  906. (string-append "\"" (which "addr2line") " ")))))
  907. (add-after 'install 'glib-or-gtk-wrap
  908. (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
  909. (native-inputs
  910. `(("cppunit" ,cppunit)
  911. ("gcc" ,gcc-8)
  912. ("gettext" ,gettext-minimal)
  913. ("help2man" ,help2man)
  914. ("pkg-config" ,pkg-config)))
  915. (inputs
  916. `(("alsa-lib" ,alsa-lib)
  917. ("gtk+" ,gtk+)
  918. ("librsvg" ,librsvg)
  919. ("libsndfile" ,libsndfile)
  920. ("libxml2" ,libxml2)
  921. ("libzip" ,libzip)
  922. ("lua" ,lua)
  923. ("poppler" ,poppler)
  924. ("portaudio" ,portaudio)
  925. ("texlive-bin" ,texlive-bin)))
  926. (home-page "https://github.com/xournalpp/xournalpp")
  927. (synopsis "Handwriting notetaking software with PDF annotation support")
  928. (description "Xournal++ is a hand note taking software written in
  929. C++ with the target of flexibility, functionality and speed. Stroke
  930. recognizer and other parts are based on Xournal code.
  931. Xournal++ features:
  932. @itemize
  933. @item Support for Pen pressure, e.g., Wacom Tablet
  934. @item Support for annotating PDFs
  935. @item Fill shape functionality
  936. @item PDF Export (with and without paper style)
  937. @item PNG Export (with and without transparent background)
  938. @item Map different tools / colors etc. to stylus buttons /
  939. mouse buttons
  940. @item Sidebar with Page Previews with advanced page sorting, PDF
  941. Bookmarks and Layers (can be individually hidden, editing layer can be
  942. selected)
  943. @item enhanced support for image insertion
  944. @item Eraser with multiple configurations
  945. @item LaTeX support
  946. @item bug reporting, autosave, and auto backup tools
  947. @item Customizeable toolbar, with multiple configurations, e.g., to
  948. optimize toolbar for portrait / landscape
  949. @item Page Template definitions
  950. @item Shape drawing (line, arrow, circle, rectangle)
  951. @item Shape resizing and rotation
  952. @item Rotation snapping every 45 degrees
  953. @item Rect snapping to grid
  954. @item Audio recording and playback alongside with handwritten notes
  955. @item Multi Language Support, Like English, German, Italian...
  956. @item Plugins using LUA Scripting
  957. @end itemize")
  958. (license license:gpl2+)))
  959. (define-public python-reportlab
  960. (package
  961. (name "python-reportlab")
  962. (version "3.5.42")
  963. (source (origin
  964. (method url-fetch)
  965. (uri (pypi-uri "reportlab" version))
  966. (sha256
  967. (base32
  968. "0i17qgm7gzy7pzp240mkpsx9rn8rr67jh5npp5bylv3sd41g48cw"))))
  969. (build-system python-build-system)
  970. (arguments
  971. '(;; FIXME: There is one test failure, building the pdf manual from source,
  972. ;; but it does not cause the build to fail.
  973. #:test-target "tests"
  974. #:configure-flags (list "--use-system-libart")
  975. #:phases
  976. (modify-phases %standard-phases
  977. (add-after 'unpack 'find-libraries
  978. (lambda* (#:key inputs #:allow-other-keys)
  979. (let ((libart (assoc-ref inputs "libart-lgpl"))
  980. (freetype (assoc-ref inputs "freetype"))
  981. (dlt1 (assoc-ref inputs "font-curve-files")))
  982. (substitute* "setup.py"
  983. (("/usr/include/libart-\\*")
  984. (string-append libart "/include/libart-2.0"))
  985. (("/usr/include/freetype2")
  986. (string-append freetype "/include"))
  987. (("http://www.reportlab.com/ftp/pfbfer-20180109.zip")
  988. (string-append "file://" dlt1)))
  989. #t))))))
  990. (inputs
  991. `(("freetype" ,freetype)
  992. ("libart-lgpl" ,libart-lgpl)
  993. ("font-curve-files"
  994. ,(origin
  995. (method url-fetch)
  996. (uri "http://www.reportlab.com/ftp/pfbfer-20180109.zip")
  997. (sha256
  998. (base32
  999. "1v0gy4mbx02ys96ssx89420y0njknlrxs2bx64bv4rp8a0al66w5"))))))
  1000. (propagated-inputs
  1001. `(("python-pillow" ,python-pillow)))
  1002. (home-page "https://www.reportlab.com")
  1003. (synopsis "Python library for generating PDFs and graphics")
  1004. (description "This is the ReportLab PDF Toolkit. It allows rapid creation
  1005. of rich PDF documents, and also creation of charts in a variety of bitmap and
  1006. vector formats.")
  1007. (license license:bsd-3)))
  1008. (define-public python2-reportlab
  1009. (package-with-python2 python-reportlab))
  1010. (define-public impressive
  1011. (package
  1012. (name "impressive")
  1013. (version "0.12.1")
  1014. (source (origin
  1015. (method url-fetch)
  1016. (uri (string-append
  1017. "mirror://sourceforge/impressive/Impressive/"
  1018. version "/Impressive-" version ".tar.gz"))
  1019. (sha256
  1020. (base32
  1021. "1r7ihv41awnlnlry1kymb8fka053wdhzibfwcarn78rr3vs338vl"))))
  1022. (build-system python-build-system)
  1023. ;; TODO: Add dependency on pdftk.
  1024. (inputs `(("python2-pygame" ,python2-pygame)
  1025. ("python2-pillow" ,python2-pillow)
  1026. ("sdl" ,sdl)
  1027. ("xpdf" ,xpdf)))
  1028. (arguments
  1029. `(#:python ,python-2
  1030. #:phases (modify-phases %standard-phases
  1031. (delete 'build)
  1032. (delete 'configure)
  1033. (delete 'check)
  1034. (replace 'install
  1035. (lambda* (#:key inputs outputs #:allow-other-keys)
  1036. ;; There's no 'setup.py' so install things manually.
  1037. (let* ((out (assoc-ref outputs "out"))
  1038. (bin (string-append out "/bin"))
  1039. (man1 (string-append out "/share/man/man1"))
  1040. (sdl (assoc-ref inputs "sdl"))
  1041. (xpdf (assoc-ref inputs "xpdf")))
  1042. (mkdir-p bin)
  1043. (copy-file "impressive.py"
  1044. (string-append bin "/impressive"))
  1045. (wrap-program (string-append bin "/impressive")
  1046. `("LIBRARY_PATH" ":" prefix ;for ctypes
  1047. (,(string-append sdl "/lib")))
  1048. `("PATH" ":" prefix ;for pdftoppm
  1049. (,(string-append xpdf "/bin"))))
  1050. (install-file "impressive.1" man1)
  1051. #t))))))
  1052. (home-page "http://impressive.sourceforge.net")
  1053. (synopsis "PDF presentation tool with visual effects")
  1054. (description
  1055. "Impressive is a tool to display PDF files that provides visual effects
  1056. such as smooth alpha-blended slide transitions. It provides additional tools
  1057. such as zooming, highlighting an area of the screen, and a tool to navigate
  1058. the PDF pages.")
  1059. (license license:gpl2)))
  1060. (define-public img2pdf
  1061. (package
  1062. (name "img2pdf")
  1063. (version "0.4.1")
  1064. (source
  1065. (origin
  1066. (method url-fetch)
  1067. (uri (pypi-uri "img2pdf" version))
  1068. (sha256
  1069. (base32 "0ljmxp7myxccfdy4kxpn4jzq35qs4pbmmmnih9vis8abm2f2589q"))))
  1070. (build-system python-build-system)
  1071. (propagated-inputs
  1072. `(("python-pikepdf" ,python-pikepdf)
  1073. ("python-pillow" ,python-pillow)
  1074. ("python-tkinter" ,python "tk")))
  1075. (home-page "https://gitlab.mister-muffin.de/josch/img2pdf")
  1076. (synopsis "Convert images to PDF via direct JPEG inclusion")
  1077. (description
  1078. "img2pdf converts images to PDF via direct JPEG inclusion. That
  1079. conversion is lossless: the image embedded in the PDF has the exact same color
  1080. information for every pixel as the input.")
  1081. (license license:lgpl3)))
  1082. (define-public fbida
  1083. (package
  1084. (name "fbida")
  1085. (version "2.14")
  1086. (home-page "https://www.kraxel.org/blog/linux/fbida/")
  1087. (source (origin
  1088. (method url-fetch)
  1089. (uri (string-append "https://www.kraxel.org/releases/fbida/"
  1090. "fbida-" version ".tar.gz"))
  1091. (sha256
  1092. (base32
  1093. "0f242mix20rgsqz1llibhsz4r2pbvx6k32rmky0zjvnbaqaw1dwm"))))
  1094. (build-system gnu-build-system)
  1095. (arguments
  1096. `(#:phases
  1097. (modify-phases %standard-phases
  1098. (add-after 'unpack 'patch-FHS-file-names
  1099. (lambda _
  1100. (substitute* "mk/Autoconf.mk"
  1101. (("/bin/echo") "echo")
  1102. (("/sbin/ldconfig -p") "echo lib")) #t))
  1103. (delete 'configure))
  1104. #:tests? #f
  1105. #:make-flags (list ,(string-append "CC=" (cc-for-target))
  1106. (string-append "prefix=" (assoc-ref %outputs "out")))))
  1107. (inputs `(("libjpeg" ,libjpeg-turbo)
  1108. ("curl" ,curl)
  1109. ("libtiff" ,libtiff)
  1110. ("libudev" ,eudev)
  1111. ("libwebp" ,libwebp)
  1112. ("libdrm" ,libdrm)
  1113. ("giflib" ,giflib)
  1114. ("glib" ,glib)
  1115. ("cairo-xcb" ,cairo-xcb)
  1116. ("freetype" ,freetype)
  1117. ("fontconfig" ,fontconfig)
  1118. ("libexif" ,libexif)
  1119. ("mesa" ,mesa)
  1120. ("libepoxy" ,libepoxy)
  1121. ("libpng" ,libpng)
  1122. ("poppler" ,poppler)))
  1123. (native-inputs `(("pkg-config" ,pkg-config)))
  1124. (synopsis "Framebuffer and drm-based image viewer")
  1125. (description
  1126. "fbida contains a few applications for viewing and editing images on
  1127. the framebuffer.")
  1128. (license license:gpl2+)))
  1129. (define-public pdf2svg
  1130. (package
  1131. (name "pdf2svg")
  1132. (version "0.2.3")
  1133. (source (origin
  1134. (method git-fetch)
  1135. (uri (git-reference
  1136. (url "https://github.com/dawbarton/pdf2svg")
  1137. (commit (string-append "v" version))))
  1138. (file-name (git-file-name name version))
  1139. (sha256
  1140. (base32
  1141. "14ffdm4y26imq99wjhkrhy9lp33165xci1l5ndwfia8hz53bl02k"))))
  1142. (build-system gnu-build-system)
  1143. (inputs
  1144. `(("cairo" ,cairo)
  1145. ("poppler" ,poppler)))
  1146. (native-inputs
  1147. `(("pkg-config" ,pkg-config)))
  1148. (home-page "http://www.cityinthesky.co.uk/opensource/pdf2svg/")
  1149. (synopsis "PDF to SVG converter")
  1150. (description "@command{pdf2svg} is a simple command-line PDF to SVG
  1151. converter using the Poppler and Cairo libraries.")
  1152. (license license:gpl2+)))
  1153. (define-public python-pypdf2
  1154. (package
  1155. (name "python-pypdf2")
  1156. (version "1.26.0")
  1157. (source (origin
  1158. (method url-fetch)
  1159. (uri (pypi-uri "PyPDF2" version))
  1160. (sha256
  1161. (base32
  1162. "11a3aqljg4sawjijkvzhs3irpw0y67zivqpbjpm065ha5wpr13z2"))))
  1163. (build-system python-build-system)
  1164. (arguments
  1165. `(#:phases
  1166. (modify-phases %standard-phases
  1167. (add-after
  1168. 'unpack 'patch-test-suite
  1169. (lambda _
  1170. ;; The text-file needs to be opened in binary mode for Python 3,
  1171. ;; so patch in the "b"
  1172. (substitute* "Tests/tests.py"
  1173. (("pdftext_file = open\\(.* 'crazyones.txt'\\), 'r" line)
  1174. (string-append line "b")))
  1175. #t))
  1176. (replace 'check
  1177. (lambda _
  1178. (invoke "python" "-m" "unittest" "Tests.tests"))))))
  1179. (home-page "http://mstamy2.github.com/PyPDF2")
  1180. (synopsis "Pure Python PDF toolkit")
  1181. (description "PyPDF2 is a pure Python PDF library capable of:
  1182. @enumerate
  1183. @item extracting document information (title, author, …)
  1184. @item splitting documents page by page
  1185. @item merging documents page by page
  1186. @item cropping pages
  1187. @item merging multiple pages into a single page
  1188. @item encrypting and decrypting PDF files
  1189. @end enumerate
  1190. By being pure Python, it should run on any Python platform without any
  1191. dependencies on external libraries. It can also work entirely on
  1192. @code{StringIO} objects rather than file streams, allowing for PDF
  1193. manipulation in memory. It is therefore a useful tool for websites that
  1194. manage or manipulate PDFs.")
  1195. (license license:bsd-3)))
  1196. (define-public python2-pypdf2
  1197. (package-with-python2 python-pypdf2))
  1198. (define-public python2-pypdf
  1199. (package
  1200. (name "python2-pypdf")
  1201. (version "1.13")
  1202. (source (origin
  1203. (method url-fetch)
  1204. (uri (pypi-uri "pyPdf" version))
  1205. (sha256
  1206. (base32
  1207. "0fqfvamir7k41w84c73rghzkiv891gdr17q5iz4hgbf6r71y9v9s"))))
  1208. (build-system python-build-system)
  1209. (arguments
  1210. `(#:tests? #f ; no tests
  1211. #:python ,python-2))
  1212. (home-page "http://pybrary.net/pyPdf/")
  1213. (synopsis "Pure Python PDF toolkit")
  1214. (description "PyPDF2 is a pure Python PDF toolkit.
  1215. Note: This module isn't maintained anymore. For new projects please use
  1216. python-pypdf2 instead.")
  1217. (license license:bsd-3)))
  1218. (define-public pdfarranger
  1219. (package
  1220. (name "pdfarranger")
  1221. (version "1.7.1")
  1222. (source
  1223. (origin
  1224. (method git-fetch)
  1225. (uri (git-reference
  1226. (url "https://github.com/jeromerobert/pdfarranger")
  1227. (commit version)))
  1228. (file-name (git-file-name name version))
  1229. (sha256
  1230. (base32 "1c2mafnz8pv32wzkc2wx4q8y2x7xffpn6ag12dj7ga5n772fb6s3"))))
  1231. (build-system python-build-system)
  1232. (arguments
  1233. '(#:tests? #f ;no tests
  1234. #:phases (modify-phases %standard-phases
  1235. (add-after 'install 'wrap-for-typelib
  1236. (lambda* (#:key inputs outputs #:allow-other-keys)
  1237. (let* ((out (assoc-ref outputs "out"))
  1238. (program (string-append out "/bin/pdfarranger")))
  1239. (wrap-program program
  1240. `("GI_TYPELIB_PATH" ":" prefix
  1241. (,(getenv "GI_TYPELIB_PATH"))))
  1242. #t))))))
  1243. (native-inputs
  1244. `(("intltool" ,intltool)
  1245. ("python-distutils-extra" ,python-distutils-extra)))
  1246. (inputs
  1247. `(("gtk+" ,gtk+)
  1248. ("poppler" ,poppler)))
  1249. (propagated-inputs
  1250. `(("img2pdf" ,img2pdf)
  1251. ("python-dateutil" ,python-dateutil)
  1252. ("python-pikepdf" ,python-pikepdf)
  1253. ("python-pycairo" ,python-pycairo)
  1254. ("python-pygobject" ,python-pygobject)))
  1255. (home-page "https://github.com/jeromerobert/pdfarranger")
  1256. (synopsis "Merge, split and re-arrange pages from PDF documents")
  1257. (description
  1258. "PDF Arranger is a small application which allows one to merge or split
  1259. PDF documents and rotate, crop and rearrange their pages using an interactive
  1260. and intuitive graphical interface.
  1261. PDF Arranger was formerly known as PDF-Shuffler.")
  1262. (license license:gpl3+)))
  1263. (define-public pdfposter
  1264. (package
  1265. (name "pdfposter")
  1266. (version "0.7.post1")
  1267. (source (origin
  1268. (method url-fetch)
  1269. (uri (pypi-uri "pdftools.pdfposter" version))
  1270. (sha256
  1271. (base32
  1272. "0c1avpbr9q53yzq5ar2x485rmp9d0l3z27aham32bg7gplzd7w0j"))))
  1273. (build-system python-build-system)
  1274. (arguments
  1275. `(#:tests? #f)) ; test-suite not included in source archive
  1276. (inputs
  1277. `(("python-pypdf2" ,python-pypdf2)))
  1278. (home-page "https://pythonhosted.org/pdftools.pdfposter/")
  1279. (synopsis "Scale and tile PDF images/pages to print on multiple pages")
  1280. (description "@command{pdfposter} can be used to create a large poster by
  1281. building it from multiple pages and/or printing it on large media. It expects
  1282. as input a PDF file, normally printing on a single page. The output is again
  1283. a PDF file, maybe containing multiple pages together building the poster. The
  1284. input page will be scaled to obtain the desired size.
  1285. This is much like @command{poster} does for Postscript files, but working with
  1286. PDF. Since sometimes @command{poster} does not like your files converted from
  1287. PDF. Indeed @command{pdfposter} was inspired by @command{poster}.")
  1288. (license license:gpl3+)))
  1289. (define-public pdfgrep
  1290. (package
  1291. (name "pdfgrep")
  1292. (version "2.1.2")
  1293. (source
  1294. (origin
  1295. (method url-fetch)
  1296. (uri (string-append "https://pdfgrep.org/download/"
  1297. name "-" version ".tar.gz"))
  1298. (sha256
  1299. (base32
  1300. "1fia10djcxxl7n9jw2prargw4yzbykk6izig2443ycj9syhxrwqf"))))
  1301. (build-system gnu-build-system)
  1302. (native-inputs
  1303. `(("pkg-config" ,pkg-config)))
  1304. (inputs
  1305. `(("libgcrypt" ,libgcrypt)
  1306. ("pcre" ,pcre)
  1307. ("poppler" ,poppler)))
  1308. (home-page "https://pdfgrep.org")
  1309. (synopsis "Command-line utility to search text in PDF files")
  1310. (description
  1311. "Pdfgrep searches in pdf files for strings matching a regular expression.
  1312. Support some GNU grep options as file name output, page number output,
  1313. optional case insensitivity, count occurrences, color highlights and search in
  1314. multiple files.")
  1315. (license license:gpl2+)))
  1316. (define-public pdfpc
  1317. (package
  1318. (name "pdfpc")
  1319. (version "4.4.1")
  1320. (source
  1321. (origin
  1322. (method git-fetch)
  1323. (uri (git-reference
  1324. (url "https://github.com/pdfpc/pdfpc")
  1325. (commit (string-append "v" version))))
  1326. (file-name (git-file-name name version))
  1327. (sha256
  1328. (base32 "11n925c5jj3yfwnqkgxzqrmsrpqh8ls1g4idmqqzpsanpam1xvna"))))
  1329. (build-system cmake-build-system)
  1330. (arguments '(#:tests? #f)) ; no test target
  1331. (inputs
  1332. `(("cairo" ,cairo)
  1333. ("gtk+" ,gtk+)
  1334. ("gstreamer" ,gstreamer)
  1335. ("gst-plugins-base" ,gst-plugins-base)
  1336. ("libgee" ,libgee)
  1337. ("poppler" ,poppler)
  1338. ("pango" ,pango)
  1339. ("vala" ,vala)))
  1340. (native-inputs
  1341. `(("pkg-config" ,pkg-config)))
  1342. (home-page "https://pdfpc.github.io/")
  1343. (synopsis "Presenter console with multi-monitor support for PDF files")
  1344. (description
  1345. "pdfpc is a presentation viewer application which uses multi-monitor
  1346. output to provide meta information to the speaker during the presentation. It
  1347. is able to show a normal presentation window on one screen, while showing a
  1348. more sophisticated overview on the other one providing information like a
  1349. picture of the next slide, as well as the left over time till the end of the
  1350. presentation. The input files processed by pdfpc are PDF documents.")
  1351. (license license:gpl2+)))
  1352. (define-public paps
  1353. (package
  1354. (name "paps")
  1355. (version "0.7.1")
  1356. (source
  1357. (origin
  1358. (method url-fetch)
  1359. (uri (string-append "https://github.com/dov/paps/releases/download/v"
  1360. version "/paps-" version ".tar.gz"))
  1361. (sha256
  1362. (base32 "1z1w1fg2bvb8p92n1jlpqp3n9mq42szb2mqhh4xqmmnmfcdkpi9s"))))
  1363. (build-system gnu-build-system)
  1364. (inputs
  1365. `(("pango" ,pango)))
  1366. (native-inputs
  1367. `(("intltool" ,intltool)
  1368. ("pkg-config" ,pkg-config)))
  1369. (home-page "https://github.com/dov/paps")
  1370. (synopsis "Pango to PostScript converter")
  1371. (description
  1372. "Paps reads a UTF-8 encoded file and generates a PostScript language
  1373. rendering of the file through the Pango Cairo back end.")
  1374. (license license:lgpl2.0+)))
  1375. (define-public stapler
  1376. (package
  1377. (name "stapler")
  1378. (version "1.0.0")
  1379. (source
  1380. (origin
  1381. (method url-fetch)
  1382. (uri (pypi-uri "stapler" version))
  1383. (sha256
  1384. (base32
  1385. "0b2lbm3f79cdxcsagwhzihbzwahjabxqmbws0c8ki25gpdnygdd7"))))
  1386. (build-system python-build-system)
  1387. (arguments
  1388. '(#:phases
  1389. (modify-phases %standard-phases
  1390. (add-after 'unpack 'fix-more-itertools-version-requirement
  1391. (lambda _
  1392. ;; Tests require an version of the more-itertools module older
  1393. ;; than the one we have packaged.
  1394. (substitute* "setup.py"
  1395. (("more-itertools>=2\\.2,<6\\.0\\.0") "more-itertools>=2.2"))
  1396. #t)))))
  1397. (propagated-inputs
  1398. `(("python-more-itertools" ,python-more-itertools)
  1399. ("python-pypdf2" ,python-pypdf2)))
  1400. (home-page "https://github.com/hellerbarde/stapler")
  1401. (synopsis "PDF manipulation tool")
  1402. (description "Stapler is a pure Python alternative to PDFtk, a tool for
  1403. manipulating PDF documents from the command line. It supports
  1404. @itemize
  1405. @item cherry-picking pages and concatenating them into a new file
  1406. @item splitting a PDF document into single pages each in its own file
  1407. @item merging PDF documents with their pages interleaved
  1408. @item displaying metadata in a PDF document
  1409. @item displaying the mapping between logical and physical page numbers
  1410. @end itemize")
  1411. (license license:bsd-3)))
  1412. (define-public weasyprint
  1413. (package
  1414. (name "weasyprint")
  1415. (version "52.1")
  1416. (source
  1417. (origin
  1418. (method git-fetch)
  1419. (uri (git-reference
  1420. (url "https://github.com/FelixSchwarz/WeasyPrint")
  1421. (commit (string-append "v" version))))
  1422. (file-name (git-file-name name version))
  1423. (sha256
  1424. (base32
  1425. "0rcj9yah3bp6bbvkmny3w4csx4l5v49lc7mrk29g0x77qnwswjy7"))))
  1426. (build-system python-build-system)
  1427. (arguments
  1428. `(#:phases
  1429. (modify-phases %standard-phases
  1430. (add-after 'unpack 'patch-library-paths
  1431. (lambda* (#:key inputs #:allow-other-keys)
  1432. (let ((fontconfig (assoc-ref inputs "fontconfig"))
  1433. (glib (assoc-ref inputs "glib"))
  1434. (pango (assoc-ref inputs "pango"))
  1435. (pangoft2 (assoc-ref inputs "pangoft2")))
  1436. (substitute* "weasyprint/fonts.py"
  1437. (("'fontconfig'")
  1438. (format #f "'~a/lib/libfontconfig.so'" fontconfig))
  1439. (("'pangoft2-1.0'")
  1440. (format #f "'~a/lib/libpangoft2-1.0.so'" pango)))
  1441. (substitute* "weasyprint/text.py"
  1442. (("'gobject-2.0'")
  1443. (format #f "'~a/lib/libgobject-2.0.so'" glib))
  1444. (("'pango-1.0'")
  1445. (format #f "'~a/lib/libpango-1.0.so'" pango))
  1446. (("'pangocairo-1.0'")
  1447. (format #f "'~a/lib/libpangocairo-1.0.so'" pango)))
  1448. #t)))
  1449. (add-after 'unpack 'disable-linters
  1450. ;; Their check fails; none of our business.
  1451. (lambda _
  1452. (substitute* "setup.cfg"
  1453. ((".*pytest-flake8.*") "")
  1454. ((".*pytest-isort.*") "")
  1455. (("--flake8") "")
  1456. (("--isort") ""))
  1457. #t))
  1458. (add-before 'check 'register-dejavu-font
  1459. (lambda* (#:key inputs #:allow-other-keys)
  1460. ;; TODO: fix FreeType so that fonts found in XDG_DATA_DIRS are
  1461. ;; honored.
  1462. (let* ((HOME "/tmp")
  1463. (dejavu (assoc-ref inputs "font-dejavu"))
  1464. (fonts-dir (string-append HOME "/.fonts")))
  1465. (setenv "HOME" HOME)
  1466. (mkdir-p fonts-dir)
  1467. (symlink (string-append dejavu "/share/fonts/truetype")
  1468. (string-append fonts-dir "/truetype"))
  1469. (invoke "fc-cache" "-rv")))))))
  1470. (inputs
  1471. `(("fontconfig" ,fontconfig)
  1472. ("glib" ,glib)
  1473. ("pango" ,pango)))
  1474. (propagated-inputs
  1475. `(("gdk-pixbuf" ,gdk-pixbuf)
  1476. ("python-cairocffi" ,python-cairocffi)
  1477. ("python-cairosvg" ,python-cairosvg)
  1478. ("python-cffi" ,python-cffi)
  1479. ("python-cssselect2" ,python-cssselect2)
  1480. ("python-html5lib" ,python-html5lib)
  1481. ("python-pyphen" ,python-pyphen)
  1482. ("python-tinycss2" ,python-tinycss2)))
  1483. (native-inputs
  1484. `(("font-dejavu" ,font-dejavu) ;tests depend on it
  1485. ("python-pytest-cov" ,python-pytest-cov)
  1486. ("python-pytest-runner" ,python-pytest-runner)))
  1487. (home-page "https://weasyprint.org/")
  1488. (synopsis "Document factory for creating PDF files from HTML")
  1489. (description "WeasyPrint helps web developers to create PDF documents. It
  1490. turns simple HTML pages into gorgeous statistical reports, invoices, tickets,
  1491. etc.
  1492. From a technical point of view, WeasyPrint is a visual rendering engine for
  1493. HTML and CSS that can export to PDF and PNG. It aims to support web standards
  1494. for printing.
  1495. It is based on various libraries but not on a full rendering engine like
  1496. WebKit or Gecko. The CSS layout engine is written in Python, designed for
  1497. pagination, and meant to be easy to hack on. Weasyprint can also be used as a
  1498. python library.
  1499. Keywords: html2pdf, htmltopdf")
  1500. (license license:bsd-3)))