3
I’m using the library mpdf
to try to display in pdf
a file created in php
But I’m having a hard time making the same thing work, and I think the way I’m trying to be is not the right way.
The archive php
contains php
and html
in its structure and will not have to be different, but if this is a hindrance to the functioning would also like some guidance.
What I got is this:
define('MPDF_PATH', 'class/mpdf/'); // include(MPDF_PATH.'mpdf.php'); include('../_comp/externos/mpdf60/mpdf.php'); $mpdf = new mPDF(); $mpdf->WriteHTML('Hello World'); $mpdf->Output(); exit();
Where is the:
$mpdf->WriteHTML('Hello World');
I tried to put a include, but it didn’t work, then I tried it with an iframe, but nothing either.
I tried to use file_get_contents() as suggested, but the return is this.
Already tried using the function
file_get_contents
specifying the URL to access the desired PHP file? This way the server will parse the file and return only the generated HTML code.– Woss
Hello @Andersoncarloswoss, yes I did a test, but the page is coming all messed up with php, I will put what returns in the pegunta. Thanks for the tip.
– adventistapr
You are using a PHP server, such as Apache?
– Woss
Because it seems that you are trying to recover the contents of the file without interpreting it. You can also use the native PHP server itself, via the command
php -S
and callfile_get_contents("http://localhost:8000/arquivo.php")
.– Woss