Try img2pdf to generate the pdf
Issue : Xournal can't edit ??
This commit is contained in:
@@ -4,6 +4,7 @@ import json
|
||||
import shutil
|
||||
import concurrent.futures
|
||||
import threading
|
||||
import img2pdf
|
||||
|
||||
# Fix for Matplotlib in threads: Set backend to non-interactive 'Agg'
|
||||
import matplotlib
|
||||
@@ -224,8 +225,17 @@ def process_student(args):
|
||||
with open(os.path.join(output_dir, "checkboxes.json"), "w") as f:
|
||||
json.dump(final_json_map, f, indent=2)
|
||||
|
||||
concat_img.save(os.path.join(output_dir, "Reference.png"))
|
||||
concat_img.save(os.path.join(output_dir, "Concat.pdf"), "PDF", resolution=DPI)
|
||||
|
||||
# Pour éviter du drift
|
||||
temp_img_path = os.path.join(output_dir, "Reference.jpg")
|
||||
concat_img.save(temp_img_path, quality=90) # Save as standard image first
|
||||
with open(os.path.join(output_dir, "Concat.pdf"), "wb") as f:
|
||||
f.write(img2pdf.convert(temp_img_path))
|
||||
|
||||
# Ancien code, avec du drift
|
||||
# concat_img.save(os.path.join(output_dir, "Concat.pdf"), "PDF", resolution=DPI)
|
||||
# concat_img.save(os.path.join(output_dir, "Reference.png"))
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user