Use pdftk in zine_maker rather than pdfseparate
This commit is contained in:
parent
b0e86e99f6
commit
5783f23cc4
2 changed files with 8 additions and 1 deletions
|
|
@ -16,8 +16,15 @@ def shuffle_zine(finput, foutput):
|
||||||
# set font for all text
|
# set font for all text
|
||||||
zine = Zine(orientation="P", unit="mm", format="A5")
|
zine = Zine(orientation="P", unit="mm", format="A5")
|
||||||
chapter_list = zine.shuffle_chapters(finput)
|
chapter_list = zine.shuffle_chapters(finput)
|
||||||
|
|
||||||
|
with open('chapters.txt', 'w') as chapt:
|
||||||
|
for i in chapter_list:
|
||||||
|
chapt.write(i)
|
||||||
|
chapt.write("\n")
|
||||||
|
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
["pdfunite"] + chapter_list + [foutput],
|
["pdfunite"] + chapter_list + [foutput],
|
||||||
|
# ["pdftk"] + ["$(cat chapters.txt)", "cat", "output"] + [foutput],
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE
|
stderr=subprocess.PIPE
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class Zine(FPDF):
|
||||||
# TODO add 2 blank pages after the cover and colophon
|
# TODO add 2 blank pages after the cover and colophon
|
||||||
# check if we have an odd number of pages
|
# check if we have an odd number of pages
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["pdfseparate", "%s" % pdfinput, "./%02d_chapter.pdf"],
|
["pdftk", "%s" % pdfinput, "burst", "output", "./%02d_chapter.pdf"],
|
||||||
stdout=subprocess.PIPE, text=True)
|
stdout=subprocess.PIPE, text=True)
|
||||||
pages = glob.glob("./*_chapter.pdf")
|
pages = glob.glob("./*_chapter.pdf")
|
||||||
pages.sort()
|
pages.sort()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue