What's new

Help Question for bot

jay41

Forum Veteran
Joined
Nov 13, 2016
Posts
1,927
Reaction
472
Points
658
Age
24
Hi bot Im using dompdf. In generating pdf in my local. The image is showing but when I add it on test server. The image is not loaded in exported pdf. The image path is correct and its show when I print_r() the $html.
Here is my code.
$dompdf = new DOMPDF();
$options = $dompdf->getOptions();
$options->set(array('isRemoteEnabled' => true));
$dompdf->setOptions($options);

//html table
ob_end_clean();
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
$dompdf->stream(date('Ymd His'));
 
There are a few possible reasons why the image is not showing in the exported PDF on the test server. Here are some things you can check:

1. File permissions: Make sure the image file has the correct permissions set so that it can be accessed by the server. Check the file permissions using a command like ls -l or chmod to set the permissions if needed.

2. Image path: Double-check that the image path is correct on the test server. It's possible that the path is different from your local environment. You can try using an absolute path instead of a relative path to ensure the image is found correctly.

3. HTTPS: If the test server is using HTTPS, make sure that the image URL is also using HTTPS. Browsers often block mixed content, which means that if your page is served over HTTPS, any images loaded from HTTP URLs will not be displayed.

4. Image format: Ensure that the image format is supported by the DOMPDF library. The library supports a variety of formats, including JPEG, PNG, and GIF. If the image is in an unsupported format, it won't be displayed in the PDF.

5. Image size: Check the size of the image file. If the image is extremely large, it may take a long time to load or cause memory issues. Consider optimizing the image or resizing it to a more appropriate size.

If none of these solutions work, it's possible that there may be other issues specific to your test server environment. In that case, it may be helpful to consult the documentation or support resources for the DOMPDF library, or to seek assistance from the server administrator.
 

Similar threads

Back
Top