Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
adding support for web fonts timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
gulien committed Feb 1, 2019
1 parent 6340186 commit e2a0ddc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ services:
- ./:/usr/src/app:rw

gotenberg:
image: thecodingmachine/gotenberg:4
image: thecodingmachine/gotenberg:4.1
container_name: gotenberg
restart: 'no'
14 changes: 14 additions & 0 deletions src/ChromeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ abstract class ChromeRequest extends Request implements GotenbergRequestInterfac
/** @var bool */
protected $landscape;

/** @var int|null */
protected $webFontsTimeout;

/**
* @return array<string,mixed>
*/
Expand Down Expand Up @@ -58,6 +61,9 @@ public function getFormValues(): array
if (!is_null($this->marginRight)) {
$values[self::MARGIN_RIGHT] = $this->marginRight;
}
if (!is_null($this->webFontsTimeout)) {
$values[self::WEB_FONTS_TIMEOUT] = $this->webFontsTimeout;
}
$values[self::LANDSCAPE] = $this->landscape;
return $values;
}
Expand Down Expand Up @@ -176,4 +182,12 @@ public function setLandscape(bool $landscape): void
{
$this->landscape = $landscape;
}

/**
* @param int|null $webFontsTimeout
*/
public function setWebFontsTimeout(?int $webFontsTimeout): void
{
$this->webFontsTimeout = $webFontsTimeout;
}
}
1 change: 0 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Safe\Exceptions\FilesystemException;
use function Safe\mkdir;
use function Safe\fopen;
use function Safe\fwrite;
use function Safe\fclose;
Expand Down
1 change: 1 addition & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ abstract class Request
protected const MARGIN_LEFT = 'marginLeft';
protected const MARGIN_RIGHT = 'marginRight';
protected const LANDSCAPE = 'landscape';
protected const WEB_FONTS_TIMEOUT = 'webFontsTimeout';

/** @var string|null */
protected $webhookURL;
Expand Down
4 changes: 4 additions & 0 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private function createHTMLRequest(): HTMLRequest
$request->setAssets($assets);
$request->setPaperSize(Request::A4);
$request->setMargins(Request::NO_MARGINS);
$request->setWebFontsTimeout(500);
return $request;
}

Expand All @@ -72,6 +73,7 @@ private function createURLRequest(): URLRequest
$request->setFooter($footer);
$request->setPaperSize(Request::A4);
$request->setMargins(Request::NO_MARGINS);
$request->setWebFontsTimeout(500);
return $request;
}

Expand Down Expand Up @@ -100,6 +102,7 @@ public function createMarkdownRequest(): MarkdownRequest
$request->setAssets($assets);
$request->setPaperSize(Request::A4);
$request->setMargins(Request::NO_MARGINS);
$request->setWebFontsTimeout(500);
return $request;
}

Expand All @@ -125,6 +128,7 @@ public function createMergeRequest(): MergeRequest
DocumentFactory::makeFromPath('gotenberg2.pdf', __DIR__ . '/assets/pdf/gotenberg.pdf'),
];
$request = new MergeRequest($files);

return $request;
}

Expand Down

0 comments on commit e2a0ddc

Please sign in to comment.