diff --git a/src/winziprint.py b/src/winziprint.py index 14191ce..cdb2aae 100755 --- a/src/winziprint.py +++ b/src/winziprint.py @@ -16,7 +16,7 @@ import weasyprint import pypdf -VERSION = __version__ = '0.2.1' +VERSION = __version__ = '0.2.2' SOCKET_ADDRESS = ('127.0.0.1', 30983) BATCH_SIZE = 10 @@ -78,7 +78,7 @@ def convert(input_files: list[str], page_nums[letterhead[1]] = 1 letterhead = None if file_name.endswith('.pdf'): - if file_name.startswith('#'): + if padding and file_name.startswith('#'): r = pypdf.PdfReader(file_name.lstrip('!#')) letterhead = (r.pages[0], p0) del r @@ -87,7 +87,7 @@ def convert(input_files: list[str], else: batch_page_nums = tmp_page_nums[i // BATCH_SIZE * BATCH_SIZE:(i // BATCH_SIZE + 1) * BATCH_SIZE] page_start = sum(batch_page_nums[:i % BATCH_SIZE]) - if file_name.startswith('#'): + if padding and file_name.startswith('#'): r = pypdf.PdfReader(tmp_file_names[i // BATCH_SIZE]) letterhead = (r.pages[0], p0) del r @@ -96,7 +96,7 @@ def convert(input_files: list[str], i += 1 p1 = len(merger.pages) page_nums.append(p1 - p0) - if padding and file_name[0] != '!' and len(merger.pages) % 2 != 0: + if padding and file_name[0] not in ('!', '#') and len(merger.pages) % 2 != 0: if letterhead: merger.add_page(letterhead[0]) letterhead = None