Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait until frame stopped loading otherwise images are not loaded #3

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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