From 3c8689e4a26b4681546d7ac7f43c8cfba239163f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20F=20Fern=C3=A1ndez?= Date: Wed, 18 Oct 2017 08:21:36 +0200 Subject: [PATCH] [FIX] Fixed problem with margins in pdf (see #3451 #4235 #4239) (#4297) --- frappe/utils/pdf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frappe/utils/pdf.py b/frappe/utils/pdf.py index 6005346270..57c4051be6 100644 --- a/frappe/utils/pdf.py +++ b/frappe/utils/pdf.py @@ -84,6 +84,10 @@ def read_options_from_html(html): options = {} soup = BeautifulSoup(html, "html5lib") + options.update(prepare_header_footer(soup)) + + toggle_visible_pdf(soup) + # extract pdfkit options from html for html_id in ("margin-top", "margin-bottom", "margin-left", "margin-right", "page-size"): try: @@ -93,10 +97,6 @@ def read_options_from_html(html): except: pass - options.update(prepare_header_footer(soup)) - - toggle_visible_pdf(soup) - return soup.prettify(), options def prepare_header_footer(soup):