From 40bd559696d5d71396e254671cf233ef3d1aff04 Mon Sep 17 00:00:00 2001 From: Hiromu Hota Date: Thu, 15 Oct 2020 16:23:11 -0700 Subject: [PATCH] Wait until frame stopped loading otherwise images are not loaded --- pdfy/pdfy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdfy/pdfy.py b/pdfy/pdfy.py index cf05e0b..d087ea6 100644 --- a/pdfy/pdfy.py +++ b/pdfy/pdfy.py @@ -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