Reputation: 139
I am using MPDF Folder to generate a PDF file from HTML/PHP. This Generation of file is very helpful for many pages but now I am facing problem recently. In Mozila FireFox, when the pdf page is generated, IT is showing in the browser in complete format. After downloading/saving the file when I try to open it in Adobe reader, it shows me A message "Adobe Reader could not open 'mpdf.php' because it is either not a supported file type or because the file has been damaged". In Chrome , I get an error message as "Failed to load PDF document". However, in some other file file where PDF is generated, it works fine. I am not able to find the solution to this, so it would be very helpful to resolve this issue.
This is the below code which call the MPDF file to generate PDF
require("MPDF/mpdf.php");
$mpdf=new mPDF('c', 'A4');
$mpdf->WriteHTML($new);
$mpdf->Output();
Upvotes: 0
Views: 2605
Reputation: 11
I had problems absolutely positioning a div. Displayed just fine in the browser but would not open in Adobe Reader. Reason: some warnings at beginning of generated pdf file. This fixed it for me: How to make mPDF 6.1 work with PHP 7.1.5 Basically, you have to change one line regarding the error reporting.
Upvotes: 1