Store HTML content in a pdf

Posted 5 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);

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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.