0
Good morning, I found several examples on the internet of how to generate reports with php
and mysql
, but in the examples everyone uses the php-5 and trying to do the same with the php-7.0.30 I couldn’t make the mistake (HTTP ERROR 500)
.
I tried using the library mPDF(which was already hard to find version 5.7 to download because on the official website I could not download.
Then how to generate pdf with php 7.0.30?
This is the code I’m using:
<?php
include ('pdf/mpdf.php');
$pagina =
"<html>
<body>
<h2>Relatório de Profissionais S Network</h2>
<ul>
<li>teste</li>
<li>teste</li>
<li>teste</li>
<li>teste</li>
</ul>
<h4>Fonte: http://www.snetwork.com.br</h4>
</body>
</html>
";
$arquivo = "Profissionais01.php";
$mpdf = new mPDF();
$mpdf->WriteHTML($pagina);
$mpdf->Output($arquivo, 'I');
?>
Note: I don’t use any framework (Laravel etc.) to develop the system.
Did you ever try FPDF?
– lazyFox
Hard to download? Tried here? And I believe in any version of the library,
$arquivo = "Profissionais01.php";
is wrong. Pass a pdf to the file name.– ShutUpMagda
@lazyFox did not test FPDF, it works the same as mPDF? what is the difference?
– Mayke Alisson
@Shutupmagda to download from github after downloading the zip as I do? "$file = "Profissionais01.php"; is wrong. Pass a pdf to the file name." so ? I put which name in the file?
– Mayke Alisson
@Shutupmagda is right his output should be a file
pdf
and notphp
. Come up with a name. @Mayke Alission will be different in each of the libraries because they should have different implementations, but will give everything to the same, just read the documentation.– lazyFox
Downloading the package by
GitHub
u unpack and click on the application, as you did. In its place, I would install with the Composer, in accordance with documentation recommends. Installing with the Composer is safer as it installs all library dependencies. The correct thing is to declare an extension.pdf
. Thus:Profissionais01.pdf
.– ShutUpMagda
@Shutupmagda this system that I am creating and my TCC that will be delivered next week, to use Composer I will have to change something in the project? or had changed nothing? after I have no time to reconfigure things.
– Mayke Alisson
Why not use the DOMPDF library? Tutorial for how to use HERE
– Nilson Alves