python-pdfkit icon indicating copy to clipboard operation
python-pdfkit copied to clipboard

Options through meta tags only works while generating from string

Open DeadlyJesus opened this issue 1 year ago • 0 comments

Hi,

I was trying to set options using meta tags while generating a pdf from an html file, but they were not used. While looking at pdfkit's code I noticed that the meta tag parsing is only enabled when using from_string https://github.com/JazzCore/python-pdfkit/blob/fb86d338a3706e6e0ede09170b9fa58fb740ec1e/pdfkit/pdfkit.py#L46-L47

The documentation doesn't seems to mention this restriction. Is there any reason to only allow meta tags options for string input ?

An easy workaround would be to read the html file and use from_string instead of from_file but it just seems weird. Especially since _find_options_in_meta uses both strings and file-like objects https://github.com/JazzCore/python-pdfkit/blob/fb86d338a3706e6e0ede09170b9fa58fb740ec1e/pdfkit/pdfkit.py#L277-L284

DeadlyJesus avatar Dec 01 '23 17:12 DeadlyJesus