add f3 folder
Showing
2 changed files
with
17 additions
and
0 deletions
This diff is collapsed.
Click to expand it.
... | @@ -24,6 +24,23 @@ WH_COUPLE_4 = (100, 300) | ... | @@ -24,6 +24,23 @@ WH_COUPLE_4 = (100, 300) |
24 | WH_COUPLE_5 = (100, 200) | 24 | WH_COUPLE_5 = (100, 200) |
25 | 25 | ||
26 | 26 | ||
27 | class PDFBuild: | ||
28 | |||
29 | def __init__(self, path): | ||
30 | self.path = path | ||
31 | |||
32 | def insert_img(self, img_path_list): | ||
33 | if os.path.exists(self.path): | ||
34 | pdf = fitz.Document(self.path) | ||
35 | else: | ||
36 | pdf = fitz.Document() | ||
37 | for img_path in img_path_list: | ||
38 | new_page = pdf.newPage() | ||
39 | new_page.insertImage(new_page.rect, img_path) | ||
40 | pdf.save(self.path) | ||
41 | pdf.close() | ||
42 | |||
43 | |||
27 | class PDFHandler: | 44 | class PDFHandler: |
28 | 45 | ||
29 | def __init__(self, path, img_dir_path, document_name=None): | 46 | def __init__(self, path, img_dir_path, document_name=None): | ... | ... |
-
Please register or sign in to post a comment