BookStackApp/BookStack · error · PdfExportException
PDF Export via command failed, PDF output file is empty
Error message
PDF Export via command failed, PDF output file is empty
What it means
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.
Source
Thrown at app/Exports/PdfGenerator.php:174
try {
$process->run();
} catch (ProcessTimedOutException $e) {
$cleanup();
throw new PdfExportException("PDF Export via command failed due to timeout at {$timeout} second(s)");
}
if (!$process->isSuccessful()) {
$cleanup();
throw new PdfExportException("PDF Export via command failed with exit code {$process->getExitCode()}, stdout: {$process->getOutput()}, stderr: {$process->getErrorOutput()}");
}
$pdfContents = file_get_contents($outputPdf);
$cleanup();
if ($pdfContents === false) {
throw new PdfExportException("PDF Export via command failed, unable to read PDF output file");
} else if (empty($pdfContents)) {
throw new PdfExportException("PDF Export via command failed, PDF output file is empty");
}
return $pdfContents;
}
protected function renderUsingWkhtml(string $html): string
{
$snappy = new SnappyPdf($this->getWkhtmlBinaryPath());
$options = config('exports.snappy.options');
return $snappy->getOutputFromHtml($html, $options);
}
/**
* Taken from https://github.com/barryvdh/laravel-dompdf/blob/v2.1.1/src/PDF.php
* Copyright (c) 2021 barryvdh, MIT License
* https://github.com/barryvdh/laravel-dompdf/blob/v2.1.1/LICENSE
*/
protected function convertEntities(string $subject): stringView on GitHub (pinned to 18f8469a1c)
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
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at app/Exports/PdfGenerator.php:174 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BookStackApp/BookStack@18f8469a1c (2026-09-02).
Data as JSON: /api/errors/700719572c1cb7b4.
Report an issue: GitHub.