public function downloadDocument()
{
// setting variables
if (! $storage->exists($recordID . '/compiled')) {
$storage->makeDirectory($recordID . '/compiled');
}
// Build the command
$command = [
// ...
];
// Execute the command using Symfony Process
$process = new Process($command);
$process->setTimeout(30);
try {
$process->mustRun();
} catch (ProcessFailedException $exception) {
throw new RuntimeException('compilation failed: ' . $exception->getMessage());
}
$pdfPath = $recordID . '/compiled/main.pdf';
if (! $storage->exists($pdfPath)) {
throw new RuntimeException('PDF file does not exist after compilation.');
}
return Storage::download($pdfPath);
}
public function downloadDocument()
{
// setting variables
if (! $storage->exists($recordID . '/compiled')) {
$storage->makeDirectory($recordID . '/compiled');
}
// Build the command
$command = [
// ...
];
// Execute the command using Symfony Process
$process = new Process($command);
$process->setTimeout(30);
try {
$process->mustRun();
} catch (ProcessFailedException $exception) {
throw new RuntimeException('compilation failed: ' . $exception->getMessage());
}
$pdfPath = $recordID . '/compiled/main.pdf';
if (! $storage->exists($pdfPath)) {
throw new RuntimeException('PDF file does not exist after compilation.');
}
return Storage::download($pdfPath);
}