I have a big problem with FPDF
I have too many codes in my page and Finally I create a PDF file with this sample:
is required ('fpdf.php'); $ Pdf = new FPDF (); $ Pdf- & gt; AddPage (); $ Pdf- & gt; SetFont ('Aerial', 'B', 16); $ Pdf- & gt; Cell (40,10, 'Hello World!'); Ob_end_clean (); $ Pdf- & gt; Output ();
The result is that only PDFs are created and the second code number!
The first sample code is:
is required ('fpdf.php'); $ Pdf = new FPDF (); $ Pdf- & gt; AddPage (); $ Pdf- & gt; SetFont ('Aerial', 'B', 16); $ Pdf- & gt; Cell (40,10, 'Hello World!'); // ob_end_clean (); $ Pdf- & gt; Output ();
In this way, before executing the code without problems, but there is no PDF and I get it on the browser:
FPDF error: Some data can not already send output, PDF file
Can you help me? IM NB with FPDF libraries
That's because your php code already outputted Check some data in the browser to check that your PHP browser does not write any data (except for headers) before calling $ pdf-> Output ()
Avoid sending unwanted data like PDF binary data
ob_end_clean ()
function calls to ensure that Process your script can make your PHP script any previous output.
No comments:
Post a Comment