Embed & Print Multi‑Page PDF Alongside ERPNext Print Format (Merge on Print)

Hello everyone,

I’m trying to implement a feature in ERPNext: I have a Print Format and I also have external PDFs (often multi‑page) attached to the document (for example, terms & conditions, spec sheets, annexures).
My goal is:

  • When I “Print” the document (e.g. Sales Invoice, Delivery Note, etc.), I want to render the Print Format as PDF, then append all pages of the attached PDF(s), and deliver a single merged PDF to the user.
  • I want this to work even when the attached PDF has multiple pages.

I see a couple of challenges:

  1. The default Print Format engine (wkhtmltopdf) or Jinja-based printing doesn’t natively support embedding or merging full PDFs.
  2. Embedding via <object> or <iframe> tags typically won’t render in the final printed PDF, especially for multipage content.

I’m considering (server-side merge) and I’d like feedback, robustness ideas, or better alternatives from the community.