Merge a list of PdfDocument objects into a single PdfDocument object #327
-
|
Is there a way to merge a list of preprocessed PdfDocument objects into a single PdfDocument object? I have tried with import_pages method but it gives an error on the second iteration. |
Beta Was this translation helpful? Give feedback.
Answered by
mara004
Sep 16, 2024
Replies: 1 comment 5 replies
-
|
Post a reproducible example (code, input file, traceback), then I can take a look. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Looks like
gather_pages_to_unique_doc(), which triggers the error, might do OOB index access.You're counting up
idx_pagewithout checking the document's length.The
pagesargument ofimport_pages()is, of course, relative to the document being imported, so perhaps you always want the first page (index 0) instead of counting up?