diff --git a/frappe/utils/print_utils.py b/frappe/utils/print_utils.py index 9c25aac38f..cfa91330da 100644 --- a/frappe/utils/print_utils.py +++ b/frappe/utils/print_utils.py @@ -95,6 +95,15 @@ def get_print( ) # if hook returns a value, assume it was the correct pdf_generator and return it if pdf: + if output and isinstance(pdf, bytes): + from io import BytesIO + + from pypdf import PdfReader + + reader = PdfReader(BytesIO(pdf)) + for page in reader.pages: + output.add_page(page) + return output return pdf for hook in frappe.get_hooks("on_print_pdf"):