adamjhn
129
10
Laravel

Store HTML content in a pdf

Posted 8 months ago by adamjhn

I have this code to get the content of a certificate:

$certificate = RegistrationType::find($request->send_to)->certificate;
$certificateContent = RegistrationType::with('certificate')->where('id', $request->send_to);
dd($certificateContent->content);

The content is stored in the "content" column of the certificates table, can be for example:

<p>certificate content</p>

Do you know how put this content in a pdf using the laravel-dompdf?

To put the content in a view in a pdf can be like below but Im not understanding how to put the html content stored in the content column into a pdf.

$pdf = PDF::loadView('pdf.invoice', compact('invoice'));
return $pdf->download('invoice.pdf');


Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.