Skip to content
Discussion options

You must be logged in to vote

Ok, thanks for the clarifications.
Then - before doing .insert_pdf() - you should bake() the source. Then code the the PDF insertion as

target.insert_pdf(source, annots=False, widgets=False, links=False, final=True)

This will at a minimum speed up the method - maybe also solve a few other issues.
You may also consider saving / recycling the target to help keeping memory requirements under control, e.g. after every 10th insert_pdf(). Rough idea

for i, update in enumerate(updates): doc = pymupdf.open(template_path) for page in doc: widgets = page.widgets() or [] for w in widgets: print(w.field_name) if w.field_name in update: w.

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@ODAFF-Zane
Comment options

@ODAFF-Zane
Comment options

Comment options

You must be logged in to vote
1 reply
@ODAFF-Zane
Comment options

Comment options

You must be logged in to vote
1 reply
@ODAFF-Zane
Comment options

Answer selected by ODAFF-Zane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants