[FIX] Fixed problem with margins in pdf (see #3451 #4235 #4239) (#4297)

This commit is contained in:
Juan F Fernández 2017-10-18 08:21:36 +02:00 committed by Faris Ansari
parent 4df6135c3c
commit 3c8689e4a2

View file

@ -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):