From ee2302054903607e9d4396ac24c677baf8ded405 Mon Sep 17 00:00:00 2001 From: Yannick de Lange Date: Sun, 25 Apr 2021 15:04:23 +0200 Subject: [PATCH] Added --permit-file-read when getting number of pages --- src/PDFLib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PDFLib.php b/src/PDFLib.php index f3cae5d..bc76387 100644 --- a/src/PDFLib.php +++ b/src/PDFLib.php @@ -153,7 +153,7 @@ public function getNumberOfPages(){ if($this->gs_command == "gswin32c.exe" || $this->gs_command == "gswin64c.exe"){ $this->pdf_path = str_replace('\\', '/', $this->pdf_path); } - $pages = $this->executeGS('-q -dNODISPLAY -c "('.$this->pdf_path.') (r) file runpdfbegin pdfpagecount = quit"',true); + $pages = $this->executeGS('-q --permit-file-read="'.dirname($this->pdf_path).'/" -dNODISPLAY -c "('.$this->pdf_path.') (r) file runpdfbegin pdfpagecount = quit"',true); $this->number_of_pages = intval($pages); } return $this->number_of_pages;