php - codeigniter and fpdf code blockin during pdf output -


i have big problem fpdf

in page have lot of code , @ end create pdf file sample:

require('fpdf.php'); $pdf = new fpdf(); $pdf->addpage(); $pdf->setfont('arial','b',16); $pdf->cell(40,10,'hello world!'); ob_end_clean(); $pdf->output(); 

the result creatioin of pdf make , other code no !

first code of sample is:

require('fpdf.php'); $pdf = new fpdf(); $pdf->addpage(); $pdf->setfont('arial','b',16); $pdf->cell(40,10,'hello world!'); //ob_end_clean(); $pdf->output(); 

like code before execute without problem not pdf , receive on browser:

fpdf error: data has been output, can't send pdf file 

can me ? im newbie fpdf libraries

that because php code has already outputted data browser. check php not write data browser yet ( except headers ) before calling $pdf->output(), avoiding sending unknown data has pdf binary data appended @ end.

the ob_end_clean() function call ensure script clean previous output php script have made.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -