Wednesday 18 July 2018

Image not found or type unknown (Get tinymce content in a pdf using dompdf)

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 so I have the code below.

The issue is that in the pdf file, if is inserted an image in the textarea, the image dont appear in the pdf and in the pdf appears "Image not found or type unknown".

Do you know what can be the issue?

The image is stored like this in the content column of the certificates table:

<p>test<img src="/img/image_15zdbBr.jpeg" alt="" width="1200" height="900" /></p>

Code to get the pdf:

$certificateContent = RegistrationType::with('certificate')->where('id', $request->registrationType)->first();
$pdf = app()->make('dompdf.wrapper');
$pdf->loadHTML($certificateContent->certificate->content);
return $pdf->download('test.pdf');

Tinymce code has relative_urls as false:

tinymce.init({
                    selector:'textarea',
                    plugins: 'image code link',
                    relative_urls: false,
                    file_browser_callback: function(field_name, url, type, win) {
                        // trigger file upload form
                        if (type == 'image') $('#formUpload input').click();
                    }
                }

);



from Image not found or type unknown (Get tinymce content in a pdf using dompdf)

No comments:

Post a Comment