fix: provide full mPDF configuration to avoid null array offset errors
This commit is contained in:
@@ -284,13 +284,20 @@ class PagesController extends Controller
|
||||
];
|
||||
|
||||
// Configure mPDF to use a writable directory
|
||||
$config = [
|
||||
'temp_dir' => storage_path('temp')
|
||||
];
|
||||
if (!file_exists(storage_path('temp'))) {
|
||||
mkdir(storage_path('temp'), 0755, true);
|
||||
$writableTemp = storage_path('temp');
|
||||
if (!file_exists($writableTemp)) {
|
||||
mkdir($writableTemp, 0755, true);
|
||||
}
|
||||
|
||||
$config = [
|
||||
'tempDir' => $writableTemp,
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'letter',
|
||||
'author' => 'St John Church',
|
||||
'creator' => 'St John Church',
|
||||
'display_mode' => 'fullpage',
|
||||
];
|
||||
|
||||
$pdf = PDF::loadView('receiptpdf', $checkout_data, [], $config);
|
||||
return $pdf->download('receipt-'.$checkoutid.'.pdf');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user