Skip to content

Commit

Permalink
Merge pull request #3 from HiromuHota/fix/image_not_loaded
Browse files Browse the repository at this point in the history
Wait until frame stopped loading otherwise images are not loaded
  • Loading branch information
Mika Hämäläinen authored Oct 19, 2020
2 parents 19b1214 + 40bd559 commit 7401449
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pdfy/pdfy.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __path_to_url(self, path):

def html_to_pdf(self, html_path, pdf_path = None, options={"paperWidth": 8.3, "paperHeight":11.7, "marginTop": 0, "marginBottom":0, "marginLeft":0, "marginRight":0}):
self.chrome.Page.navigate(url=self.__resolve_path(html_path))
self.chrome.wait_event("Page.loadEventFired", timeout=60)
self.chrome.wait_event("Page.frameStoppedLoading", timeout=60)
pdf_data = self.chrome.Page.printToPDF(**options)["result"]["data"]
if pdf_path is None:
return pdf_data
Expand Down

0 comments on commit 7401449

Please sign in to comment.