Autour de Laravel

Generer un pdf ave dompdf laravel 9 en ligne

Avatar de JeremieAtuhinina
JeremieAtuhinina

Bonjour je suis foutu là je reussi à generer un pdf avec dompdf mais seulement ça marche que hors connexion , quand je le mis en ligne bah le pdf ne se genere pas et me renvoie l'erreur du serveur

voici mon controller et la fonction public function getPostPdf($post) { $grandhomme = Grandhomme::where('slug',$post)->first(); // L'instance PDF avec une vue : resources/views/posts/show.blade.php $pdf =PDF::loadView('grandh.grandhomme_pdf', compact('grandhomme')); return $pdf->download(Str::slug($grandhomme->noms) . ".pdf"); // return $pdf->stream(); } ma route Route::get('/pdf/{slug}', [GrandHommeController::class, 'getPostPdf'])->name('pdf');

 le bouton où je clique pour avoir le pdf
 <a href="{{ route('grandH.pdf', $grandhomme->slug) }}" class="btn btn-sm" target="_blank" download="">Telecharger comme PDF</a>
 
 mon pdf fichier html
 <html lang="fr">
</section>
 <section>
     <p><img src="{{ public_path('html/img/social.png') }}" alt=""></p>
     <span>grandhomme-drc.net</span>
     <span>

     </span>
 </section>
 <div>
     <img src="{{ public_path('html/img/foot.png') }}" width="500px"  alt="" style="text-align: center;">
 </div>

j'ai mis le site en ligne le pdf ne se telecharge plus besoin d'aide à mouri!!!!!!!!!

Posté il y a 1 an

Vous ne pouvez pas répondre à ce sujet.