* @param $page
* @return array
*/
- protected function getPageDimension($page)
+ protected function getPageDimension($page): ?array
{
$k = 'pagesDimensions.' . $page;
if (!$this->config->has($k)) {
$d = $this->getFluidbook()->getDocumentSize($page);
+ if (null === $d) {
+ return null;
+ }
$res = [round($this->cssWidth, 2), round($d[1] * ($this->cssWidth / $d[0]), 2)];
$this->config->set($k, $res);
return $res;
public function getWidth($page = 1)
{
- return $this->getPageDimension($page)[0];
+ return $this->getPageDimension($page)[0]??null;
}
public function getHeight($page = 1)
{
- return $this->getPageDimension($page)[1];
+ return $this->getPageDimension($page)[1]??null;
}