我有一个刀片,在那里我将Html转换为pdf并将其保存在本地,然后我使用活动URL获取pdf并将其保存在我的本地,然后我使用laravel库合并这两个pdf,它将通过嵌入生成单个pdf,它之前工作得很好,现在我有一个高质量的pdf,它需要很多时间来合并,由于它需要一些时间,它会返回一个最大限制内存问题,
所以我试着排队
这是我的代码
$ecg_link = 'https://storage.googleapis.com/staging.uk-production.appspot.com/test1111.pdf';
$ecg_pdf = isset($ecg_link) ? $ecg_link : '';
if($ecg_pdf){
$ecg_contents = file_get_contents($ecg_link);
if (!File::exists(storage_path('app/public/screening/pdf'))){
File::makeDirectory(storage_path('app/public/screening/pdf'), 0777, true, true);
}
\Storage::disk('public')->put('screening/pdf/'.$screening_id.'.pdf', $ecg_contents);
$pdf = PDF::loadView('participants.test',
compact('participantdata','Allopurinol','stn_assetreview'));
if (!File::exists(storage_path('app/public/screening/pdf/temporary-pdf'))){
File::makeDirectory(storage_path('app/public/screening/pdf/temporary-pdf'), 0777,
true, true);
}
$pdf->save(storage_path('app/public/screening/pdf/temporary-pdf/'.$screening_id.'.pdf'));
$pdfMerger = PDFMerger::init(); //Initialize the merger
$pdfMerger->addPDF(storage_path('app/public/screening/pdf/temporary-pdf/'.$screening_id.'.pdf'), 'all');
$pdfMerger->addPDF(storage_path('app/public/screening/pdf/'.$screening_id.'.pdf'), 'all' );
$pdfMerger->merge();
if (!File::exists(storage_path('app/public/screening/pdf/final-pdf'))){
File::makeDirectory(storage_path('app/public/screening/pdf/final-pdf'), 0777, true, true);
}
$pdfMerger->save($screening_id.'.pdf', "download");当我使用队列时,我无法下载excel,因为它在队列中,我有任何方法可以下载excel,否则我可以通过邮件发送这个pdf吗?
发布于 2021-08-25 22:08:16
您可以使用作业,无论何时保存数据,都可以调用YourJob::dispatch()
https://stackoverflow.com/questions/68930080
复制相似问题