book generation
This commit is contained in:
parent
851b7ab4f9
commit
e3e6820621
1 changed files with 38 additions and 35 deletions
|
@ -257,11 +257,12 @@ def main():
|
|||
print("Genero i libretti")
|
||||
os.makedirs('books', exist_ok=True)
|
||||
for pagstart in range(1, len(vgo_dict), 50):
|
||||
pdfWriter = PyPDF2.PdfFileWriter()
|
||||
|
||||
book_num = int(pagstart / 50) + 1
|
||||
pagend = min(book_num * 50, len(vgo_dict))
|
||||
|
||||
book_name = os.path.join('books', 'vgo_' + str(book_num).zfill(2) + '.pdf')
|
||||
if not os.path.isfile(book_name):
|
||||
pdfWriter = PyPDF2.PdfFileWriter()
|
||||
print(book_num)
|
||||
|
||||
# aggiungere copertina
|
||||
|
@ -297,11 +298,13 @@ def main():
|
|||
pageObj = pdfReader.getPage(0)
|
||||
pdfWriter.addPage(pageObj)
|
||||
|
||||
book_name = os.path.join('books', 'vgo_' + str(book_num).zfill(2) + '.pdf')
|
||||
with open(book_name, 'wb') as pdfOutput:
|
||||
pdfWriter.write(pdfOutput)
|
||||
|
||||
|
||||
# # Genera indice
|
||||
# with open("index.txt", 'w') as handler:
|
||||
# for key in sorted(vgo_dict):
|
||||
# handler.write(key + ' - ' + vgo_dict[key] + '\n')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue