-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error Object 203 0 not defined when using stub_to_print #8
Labels
bug
Something isn't working
Comments
Here's what I found until now:
|
Here's a test function that exhibits the bug: def bug_shower_1(trigger_bug: bool):
src_pdf_file_path = Path('/home/graffy/private/melting-notes/partitions/scans/888-bug.pdf')
tmp_dir = Path('/home/graffy/private/dev/pymusco/tickets/ticket0008/tmp')
scanned_image_file_paths = []
with open(src_pdf_file_path, 'rb') as src_pdf_file:
pdf_reader = PyPDF2.PdfReader(src_pdf_file)
page_index = 0
for page in pdf_reader.pages:
print(f'============= page_index = {page_index}')
# image_file_path = extract_pdf_page_main_image(page, image_dir=tmp_dir, image_name=('page%03d' % page_index))
image_file_path = extract_pdf_page(page, image_dir=tmp_dir, image_name=f'page{page_index:03d}')
print(image_file_path)
# check_pdf_file(image_file_path)
scanned_image_file_paths.append(image_file_path)
page_index += 1
# stamp_descs = stamp_descs if stamp_descs is not None else []
orchestra = load_orchestra('/home/graffy/private/dev/pymusco/samples/harmony.orchestra')
piece = load_piece_description(Path('/home/graffy/private/melting-notes/partitions/scans/888-bug.desc'), orchestra)
dst_stub_pdf_file_path = Path('/home/graffy/private/dev/pymusco/tickets/ticket0008/stub.pdf')
toc = piece.scan_toc
if trigger_bug:
stamp_descs = piece.stamp_descs
else:
stamp_descs = []
images_to_pdf(StubContents(image_file_paths=scanned_image_file_paths, toc=toc, title='toto', stamp_descs=stamp_descs, page_info_line_y_pos=1.0), dst_stub_pdf_file_path)
# check_pdf_file(dst_stub_pdf_file_path)
dst_stub_copy_pdf_file_path = Path('/home/graffy/private/dev/pymusco/tickets/ticket0008/stub-copy.pdf')
duplicate_pdf_file_001(dst_stub_pdf_file_path, dst_stub_copy_pdf_file_path)
# check_pdf_file(dst_pdf_file_path) |
g-raffy
added a commit
that referenced
this issue
Sep 1, 2024
…ws early detection of problems where the scan contains image formats that pypdf2 doesn't handle. work related to #8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: