8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-28 15:42:25 +00:00

[Printer] Function to create a booklet from a pdf

This commit is contained in:
Maxime Bombar 2018-10-15 03:14:37 +02:00 committed by root
parent 9cda39a1fe
commit 5aa0dd867e
2 changed files with 19 additions and 1 deletions

View file

@ -18,3 +18,4 @@ fonts-font-awesome
graphviz
git
poppler-utils
texlive-extra-utils

View file

@ -1,5 +1,5 @@
import subprocess
import os
def user_printing_path(instance, filename):
"""
@ -35,3 +35,20 @@ def pdfinfo(file_path):
output[label] = _extract(line)
return output
def pdfbook(file_path):
"""
Creates a booklet from a pdf
requires texlive-extra-utils
"""
_dir = os.path.dirname(file_path)
_fname = os.path.basename(file_path)
newfile = os.path.join(_dir, "pdfbook_%s" % (_fname,))
check_output(
['/usr/bin/pdfbook',
'--short-edge',
file_path,
'-o', newfile,
])
return newfile