diff --git a/src/Services/PdfGenerator.php b/src/Services/PdfGenerator.php index fce4d32..6e91688 100644 --- a/src/Services/PdfGenerator.php +++ b/src/Services/PdfGenerator.php @@ -52,7 +52,8 @@ class PdfGenerator $pdfFile = tempnam($this->config['tmp_dir'], 'pdf_') . '.pdf'; try { - $cmd = escapeshellcmd($this->config['pagedjs_bin']); + $cmd = 'TMPDIR=' . escapeshellarg($this->config['tmp_dir']) . ' '; + $cmd .= escapeshellcmd($this->config['pagedjs_bin']); $cmd .= ' ' . escapeshellarg($url); $cmd .= ' -o ' . escapeshellarg($pdfFile); @@ -110,7 +111,8 @@ class PdfGenerator private function buildCommand(string $htmlFile, string $pdfFile, array $options): string { - $cmd = escapeshellcmd($this->config['pagedjs_bin']); + $cmd = 'TMPDIR=' . escapeshellarg($this->config['tmp_dir']) . ' '; + $cmd .= escapeshellcmd($this->config['pagedjs_bin']); $cmd .= ' ' . escapeshellarg($htmlFile); $cmd .= ' -o ' . escapeshellarg($pdfFile);