{"record":{"id":"700719572c1cb7b4","repo":"BookStackApp/BookStack","slug":"pdf-export-via-command-failed-pdf-output-file-is","errorCode":null,"errorMessage":"PDF Export via command failed, PDF output file is empty","messagePattern":"PDF Export via command failed, PDF output file is empty","errorType":"exception","errorClass":"PdfExportException","httpStatus":null,"severity":"error","filePath":"app/Exports/PdfGenerator.php","lineNumber":174,"sourceCode":"        try {\n            $process->run();\n        } catch (ProcessTimedOutException $e) {\n            $cleanup();\n            throw new PdfExportException(\"PDF Export via command failed due to timeout at {$timeout} second(s)\");\n        }\n\n        if (!$process->isSuccessful()) {\n            $cleanup();\n            throw new PdfExportException(\"PDF Export via command failed with exit code {$process->getExitCode()}, stdout: {$process->getOutput()}, stderr: {$process->getErrorOutput()}\");\n        }\n\n        $pdfContents = file_get_contents($outputPdf);\n        $cleanup();\n\n        if ($pdfContents === false) {\n            throw new PdfExportException(\"PDF Export via command failed, unable to read PDF output file\");\n        } else if (empty($pdfContents)) {\n            throw new PdfExportException(\"PDF Export via command failed, PDF output file is empty\");\n        }\n\n        return $pdfContents;\n    }\n\n    protected function renderUsingWkhtml(string $html): string\n    {\n        $snappy = new SnappyPdf($this->getWkhtmlBinaryPath());\n        $options = config('exports.snappy.options');\n        return $snappy->getOutputFromHtml($html, $options);\n    }\n\n    /**\n     * Taken from https://github.com/barryvdh/laravel-dompdf/blob/v2.1.1/src/PDF.php\n     * Copyright (c) 2021 barryvdh, MIT License\n     * https://github.com/barryvdh/laravel-dompdf/blob/v2.1.1/LICENSE\n     */\n    protected function convertEntities(string $subject): string","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/BookStackApp/BookStack/blob/18f8469a1c72f8cc8497e9372635e6dea5028071/app/Exports/PdfGenerator.php#L156-L192","documentation":"PdfExportException thrown in PdfGenerator::renderUsingCommand after the external PDF command (e.g. weasyprint/puppeteer script) exited successfully but the produced output file was empty or unreadable via file_get_contents, meaning rendering silently produced no PDF. Typically indicates a broken/unsupported export command install.","triggerScenarios":"Thrown at app/Exports/PdfGenerator.php:174 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the configured PDF command binary is installed and a working version","Run the export command manually against a test HTML file to see its stdout/stderr","Check temp-directory permissions so the command can write its output file","Update or reinstall the PDF rendering tool"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"18f8469a1c72f8cc8497e9372635e6dea5028071","analyzedAt":"2026-09-02T19:49:33.068Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}