Skip to content

Commit cf3eb8d

Browse files
committed
fixup! Code style changes
1 parent e67a49c commit cf3eb8d

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

application/forms/BackendConfigForm.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

library/Pdfexport/Backend/WebdriverBackend.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ class WebdriverBackend implements PfdPrintBackend
1717
{
1818
protected RemoteWebDriver $driver;
1919

20+
2021
public function __construct(
21-
string $url,
22+
string $url,
2223
DesiredCapabilities $capabilities,
2324
) {
2425
$this->driver = RemoteWebDriver::create($url, $capabilities);
2526
}
2627

27-
protected function __destruct()
28+
public function __destruct()
2829
{
2930
$this->close();
3031
}
@@ -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);

0 commit comments

Comments
 (0)