Skip to content

Commit

Permalink
Wait until frame stopped loading otherwise images are not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiromu Hota committed Oct 15, 2020
1 parent 19b1214 commit 40bd559
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 40bd559

Please sign in to comment.