In the previous tutorial How Generate PDF for WordPress Post Without Plugin domPDF Tutorial, if you are interested to look at this article there is a link techboto.com/generate-pdf-wordpress-post… After we realize that this WordPress data PDF generated but not show the image that links into the post, Now we can solve this problem very easily.
You can generate a PDF file but not display images from a view using domPDF. To export into PDF, We need to enable a function called ‘isRemoteEnabled‘. We can get data from a database with the image but after generating PDF image not show image not found or type unknown write warning message, load data dynamically from the database as per the requirement. After that, we will export solve this issue as a PDF file.
Now, open dmoPDF Library inside to your server there is a file, which we can edit and generate pdf, I am sharing the image for better understand.
They are using direct link images like example:(<img scr=’https://your_image_link’) this code advantage you can generate PDF image with any website links this work pretty cool show images into text. This domPDF library has an option to enable it and your page image show on PDF file will convert your images to text.
use Dompdf\Dompdf; define("DOMPDF_UNICODE_ENABLED", true); $dompdf= new Dompdf(); $dompdf->loadHtml($aData['html']); $dompdf->set_option('isRemoteEnabled', TRUE); $dompdf->loadHtml($html); $dompdf->setPaper('A4','portrait'); $dompdf->render(); $dompdf->stream("".$pdf_title."",array("Attachment"=>0));
Now, edit this file just add this code and save it.
This code above mentions works only on an online server, if you try on the local computer it not work or show an error.