1 month ago

S3 uploading PDF from HTML

Posted 1 month ago by theUnforgiven

Hi all,

Hope everyone as had a good week.

I have a small problem, I can't seem to figure out, so I'm looking for some guidance.

I have this piece of code:

$data = request()->html;
$pdf = \App::make('dompdf.wrapper');
$pdf->setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true]);
$output = $pdf->stream(sha1(now()).'.pdf');

Which makes a PDF from HTML, but I need to upload to S3 when it outputs, and with the server been on Vapor I can't really upload to 'local' folders.

I have tried:

$path = 'ast/' . $tenancy->id . '/' . $output;
$s3 = Storage::disk('s3');
$s3->put($path, $output, 'public');
$urlPath = Storage::disk('s3')->url($path);

But I get Error executing "PutObject" on ...

Any suggestions would be greatly appreciated.

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