Im using tinymce with image upload using the package "laravel-tinymce-simple-imageupload". But when the user enters some content in the textarea and click in the form submit button I want to put the content in the textarea in a pdf file. The issue is that in the pdf file, if is inserted an image in the textarea, the image dont appear in the pdf and it shows "Image not found or type unknown.
The directory of the image uplodaded with the tinymce plugin is "~/projects/proj/public/img/image_15....".
Do you know how to get the basepath to use in the setBasePath method $pdf->getDomPDF()->setBasePath() to check if the error "Image not found or type unkown" is solved using the serBasePath()?
Remember that paths in html files are already relative to the root directory of the project and not to the file itself. In the case of Laravel your public directory is the root directory for your website.
There you're using the PDF class directly, instead of using the $pdf instance you already created (and set values for). This is a separate instance. Use $pdf there, not PDF.
Like what? I said to not use PDF:: and only posted the code where you were doing it.
use the $pdf instance you already have so you don't overwrite your original object with a new one (which doesn't have the settings you previously set on $pdf).
$pdf = app()->make('dompdf.wrapper'); // $pdf is now a PDF instance
$pdf->getDomPDF()->setBasePath(public_path().'/img/');
//$pdf = PDF::loadHTML($content); // don't create a NEW instance, use the existing $pdf instance
$pdf->loadHTML($content);
return $pdf->download('certificates.pdf');