mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-24 20:33:11 +00:00
[Printer] Function to create a booklet from a pdf
This commit is contained in:
parent
9cda39a1fe
commit
5aa0dd867e
2 changed files with 19 additions and 1 deletions
|
@ -18,3 +18,4 @@ fonts-font-awesome
|
|||
graphviz
|
||||
git
|
||||
poppler-utils
|
||||
texlive-extra-utils
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue