File tree Expand file tree Collapse file tree
library/Pdfexport/Backend Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,7 +59,6 @@ public function assemble(): void
5959 );
6060 return false ;
6161 }
62-
6362 } catch (Exception $ e ) {
6463 $ validator ->addMessage ($ e ->getMessage ());
6564 return false ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ class WebdriverBackend implements PfdPrintBackend
1717{
1818 protected RemoteWebDriver $ driver ;
1919
20+
2021 public function __construct (
2122 string $ url ,
2223 DesiredCapabilities $ capabilities ,
@@ -35,6 +36,8 @@ protected function setContent(PrintableHtmlDocument $document): void
3536 $ encoded = base64_encode ($ document );
3637 $ this ->driver ->executeScript ('document.head.remove(); ' );
3738 $ this ->driver ->executeScript ("document.body.outerHTML = atob(' $ encoded'); " );
39+ $ this ->driver ->executeScript (self ::ACTIVATE_SCRIPTS );
40+ $ this ->driver ->executeScript ('new Layout().apply(); ' );
3841 }
3942
4043 protected function waitForPageLoad (): void
@@ -71,6 +74,11 @@ public function toPdf(PrintableHtmlDocument $document): string
7174 {
7275 $ this ->setContent ($ document );
7376 $ this ->waitForPageLoad ();
77+
78+ $ path = '/tmp/chromedriver- ' . time () . '.html ' ;
79+ file_put_contents ($ path , $ this ->driver ->getPageSource ());
80+ Logger::info ("Printing page $ path. " );
81+
7482 $ printParameters = $ this ->getPrintParameters ($ document );
7583
7684 return $ this ->printToPdf ($ printParameters );
You can’t perform that action at this time.
0 commit comments