Alicia Posted April 6, 2008 Share Posted April 6, 2008 Hi guys, Can any php guru gives me an idea how can I convert the web page I generated by using php and mysql directly to pdf file. I need the pdf file to have exactly the same output and format as what I have in the web page. I used a table to display all the records (mysql_fetch_array function is used) in mysql database and I need the web page (report) to be converted to pdf everytime a user submit a query. I did try fpdf but to no avail.. anyone can suggest the easiet method to accomplish this? Please advise and thanks. Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/ Share on other sites More sharing options...
darkfreaks Posted April 6, 2008 Share Posted April 6, 2008 http://us2.php.net/pdf have fun and goodluck Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-510712 Share on other sites More sharing options...
Alicia Posted April 6, 2008 Author Share Posted April 6, 2008 pdflib is not a free module right ? anything else I can use to accomplish what I want without purchasing the license ? Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-510720 Share on other sites More sharing options...
Barand Posted April 6, 2008 Share Posted April 6, 2008 FreePDF www.fpdf.org Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-510725 Share on other sites More sharing options...
Barand Posted April 6, 2008 Share Posted April 6, 2008 Just noticed you tried that. What was the problem? I use it all the time. Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-510731 Share on other sites More sharing options...
hitman6003 Posted April 6, 2008 Share Posted April 6, 2008 Zend framework has a pretty good module for working with PDFs... http://framework.zend.com/manual/en/zend.pdf.html Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-510734 Share on other sites More sharing options...
Alicia Posted April 7, 2008 Author Share Posted April 7, 2008 i want to output this table but failed... i really confused with the cell class.. i tried to use the html sample i got from fpdf but failed as well.. please advise : //iterate through the cart, the $product_id is the key and $quantity is the value foreach($_SESSION['cart'] as $product_id => $quantity) { //use sprintf to make sure that $product_id is inserted into the query as a number - to prevent SQL injection $sql = sprintf("SELECT * FROM `hardwares` WHERE A = %d;", $product_id); $result = mysql_query($sql); //Only display the row if there is a product (though there should always be as we have already checked) if(mysql_num_rows($result) > 0) { list($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $image, $image2, $image3) = mysql_fetch_row($result); // list($name, $description, $price) = mysql_fetch_row($result); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="56%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td valign="top"><strong><u><? echo $name ?> (<? echo $code ?>)</u> : RM<? echo $price ?></strong></td> </tr> <tr> <td valign="top"><? echo $desc ?></td> </tr> <tr> <td valign="top"> </td> </tr> </table></td> <td width="44%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td valign="top"><img src="../EN/images/<? echo $image ?>" border="1"></td> </tr> <tr> <td valign="top"><? if($image2 != ""){?> <img src="../EN/images/<? echo $image2 ?>" border="1"> <? } ?></td> </tr> </table></td> </tr> </table> <? } } // close of for loop Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-510921 Share on other sites More sharing options...
Alicia Posted April 7, 2008 Author Share Posted April 7, 2008 Hi Barand, Can you check my code please.. it is not showing the table, data and image at all <?php session_start(); include "../includes/dbconn.php"; require('fpdf.php'); class PDF extends FPDF { var $B; var $I; var $U; var $HREF; function PDF($orientation='P',$unit='mm',$format='A4') { //Call parent constructor $this->FPDF($orientation,$unit,$format); //Initialization $this->B=0; $this->I=0; $this->U=0; $this->HREF=''; } function WriteHTML($html) { //HTML parser $html=str_replace("\n",' ',$html); $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE); foreach($a as $i=>$e) { if($i%2==0) { //Text if($this->HREF) $this->PutLink($this->HREF,$e); else $this->Write(5,$e); } else { //Tag if($e{0}=='/') $this->CloseTag(strtoupper(substr($e,1))); else { //Extract attributes $a2=explode(' ',$e); $tag=strtoupper(array_shift($a2)); $attr=array(); foreach($a2 as $v) if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3)) $attr[strtoupper($a3[1])]=$a3[2]; $this->OpenTag($tag,$attr); } } } } function OpenTag($tag,$attr) { //Opening tag if($tag=='B' or $tag=='I' or $tag=='U') $this->SetStyle($tag,true); if($tag=='A') $this->HREF=$attr['HREF']; if($tag=='BR') $this->Ln(5); } function CloseTag($tag) { //Closing tag if($tag=='B' or $tag=='I' or $tag=='U') $this->SetStyle($tag,false); if($tag=='A') $this->HREF=''; } function SetStyle($tag,$enable) { //Modify style and select corresponding font $this->$tag+=($enable ? 1 : -1); $style=''; foreach(array('B','I','U') as $s) if($this->$s>0) $style.=$s; $this->SetFont('',$style); } function PutLink($URL,$txt) { //Put a hyperlink $this->SetTextColor(0,0,255); $this->SetStyle('U',true); $this->Write(5,$txt,$URL); $this->SetStyle('U',false); $this->SetTextColor(0); } } // checkout module starts here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if($_SESSION['cart']) { //if the cart isn't empty //show the cart // echo "<table border=\"1\" padding=\"3\" width=\"40%\">"; //format the cart using a HTML table //iterate through the cart, the $product_id is the key and $quantity is the value foreach($_SESSION['cart'] as $product_id => $quantity) { //get the name, description and price from the database - this will depend on your database implementation. //use sprintf to make sure that $product_id is inserted into the query as a number - to prevent SQL injection $sql = sprintf("SELECT * FROM `hardware` WHERE A = %d;", $product_id); $result = mysql_query($sql); //Only display the row if there is a product (though there should always be as we have already checked) if(mysql_num_rows($result) > 0) { list($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $image, $image2, $image3) = mysql_fetch_row($result); // list($name, $description, $price) = mysql_fetch_row($result); $html=' <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="56%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td valign="top"><strong><u>$name ($code)</u> : US$price</strong></td> </tr> <tr> <td valign="top">$desc</td> </tr> <tr> <td valign="top"> </td> </tr> </table></td> <td width="44%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td valign="top"><img src="../EN/images/$image" border="1"></td> </tr> <tr> <td valign="top"> <img src="../EN/images/$image2" border="1"> </td> </tr> </table></td> </tr> </table>'; } } } // close of for loop $pdf=new PDF(); //First page /* $pdf->AddPage(); $pdf->SetFont('Arial','',20); $pdf->Write(5,'To find out what\'s new in this tutorial, click '); $pdf->SetFont('','U'); $link=$pdf->AddLink(); $pdf->Write(5,'here',$link); $pdf->SetFont(''); */ //Second page $pdf->AddPage(); $pdf->SetLink($link); $pdf->Image('logo.JPG',10,10,30,0,'','http://www.fpdf.org'); $pdf->SetLeftMargin(45); $pdf->SetFontSize(14); $pdf->WriteHTML($html); $pdf->Output(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-510945 Share on other sites More sharing options...
Alicia Posted April 9, 2008 Author Share Posted April 9, 2008 anyone can help ??? Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-513140 Share on other sites More sharing options...
darkfreaks Posted April 9, 2008 Share Posted April 9, 2008 alicia add error reporting and see if there is a flaw ??? <?php ini_set('error_reporting',E_ALL);?> Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-513223 Share on other sites More sharing options...
Alicia Posted April 11, 2008 Author Share Posted April 11, 2008 no error displayed... now no pdf file is generated.. .only word characters from the source code appear on the website... any other suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-514466 Share on other sites More sharing options...
AP81 Posted April 11, 2008 Share Posted April 11, 2008 You need to output the PDF before any HTML is outputted to the page, so you would have need to do something like this: <?php if isset($data) { createPDF($data); return; } ?> <html> <head> ... Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-514807 Share on other sites More sharing options...
Barand Posted April 11, 2008 Share Posted April 11, 2008 As with GD image code, I always put PDF creation code into a separate file and then provide a link to it. eg <a href='mypdf.php?var=x'>View PDF version</a> Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-515010 Share on other sites More sharing options...
Barand Posted April 11, 2008 Share Posted April 11, 2008 i want to output this table but failed... i really confused with the cell class.. i tried to use the html sample i got from fpdf but failed as well.. please advise : I wouldn't attempt to convert the html, I'd just create a method in my pdf clas to lay out each record and call it for each row. [pre] +----------------------------+ +------------------------+ | cell | | | | 1 | | | +----------------------------+ | picture 1 | | cell | | | | 2 | | | +----------------------------+ | | +------------------------+ | | | | | picture 2 | | | | | | | +------------------------+ [/pre] Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-515105 Share on other sites More sharing options...
Alicia Posted April 12, 2008 Author Share Posted April 12, 2008 Hi Barand, I tried to cell method but failed.. do you able to provide me any reference ? Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-515573 Share on other sites More sharing options...
darkfreaks Posted April 12, 2008 Share Posted April 12, 2008 can you provide the code ??? we will be able to tell why it failed -thanks Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-515612 Share on other sites More sharing options...
Barand Posted April 13, 2008 Share Posted April 13, 2008 sample code <?php define('FPDF_FONTPATH','C:/php/fpdf/font/'); require('fpdf.php'); mysql_connect('localhost'); mysql_select_db('test3'); class PDF extends FPDF { var $time_printed; // constructor function PDF() { parent::FPDF(); $this->time_printed = date('jS M Y g:i a'); } //Page header function Header() { //Arial bold 15 $this->SetFont('Arial','B',18); //Title $this->Cell(0,20, 'Sample PDF',0,0,'L'); //Line break $this->Ln(15); } //Page footer function Footer() { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial','I',; // time created $this->Cell(40,10,$this->time_printed,0,0,'L'); //Page number $this->Cell(0,10,'Page '.$this->PageNo().' / {nb}',0,0,'C'); } function printRecord($name, $code, $price, $desc, $im1, $im2) { $this->SetFont('Arial','B',12); $ypos = $this->getY() + 5; $this->setY($ypos); $this->Cell (100, 6, "$name ($code)", 0, 0); $this->Cell (30, 6, "\$$price", 0, 1, 'R'); $this->SetFont('Arial','I',10); $this->Cell (130, 6, 'Description', 0, 1); $this->SetFont('Arial','',10); $this->Cell(10); // indent $this->Multicell (90, 4, $desc); $ypos2 = $this->getY(); // end of text if ($im1) { $this->image ($im1, 155, $ypos, 40, 0); $ypos += 35; } if ($im2) { $this->image ($im2, 155, $ypos, 40, 0); $ypos += 35; } $this->setY(max($ypos2, $ypos)); } function printReport() { $sql = "SELECT name, code, price, description, image1, image2 FROM hardware"; $res = mysql_query($sql); while (list($name, $code, $price, $desc, $i1, $i2) = mysql_fetch_row($res)) { $this->printRecord($name, $code, $price, $desc, $i1, $i2); } } } # class //Instantiation of inherited class $pdf=new PDF(); $pdf->Open(); $pdf->setLeftMargin(15); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFillColor(200); $pdf->SetDrawColor(200); $pdf->printReport(); $pdf->output(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-515936 Share on other sites More sharing options...
Alicia Posted April 14, 2008 Author Share Posted April 14, 2008 thanks... let me try and let u know the result... Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-516536 Share on other sites More sharing options...
Alicia Posted April 14, 2008 Author Share Posted April 14, 2008 failed... =( I tried to update your code according to my requirement but no output is displayed except this error : My modified code : <?php // session used to capture product ID added into the shopping cart session_start(); include "../includes/dbconn.php"; //define('FPDF_FONTPATH','fpdf/font/'); require('fpdf.php'); class PDF extends FPDF { var $time_printed; // constructor function PDF() { parent::FPDF(); $this->time_printed = date('jS M Y g:i a'); } //Page header function Header() { //Arial bold 15 $this->SetFont('Arial','B',18); //Title $this->Cell(0,20, 'Sample PDF',0,0,'L'); //Line break $this->Ln(15); } //Page footer function Footer() { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial','I',; // time created $this->Cell(40,10,$this->time_printed,0,0,'L'); //Page number $this->Cell(0,10,'Page '.$this->PageNo().' / {nb}',0,0,'C'); } // function printRecord($name, $code, $price, $desc, $im1, $im2) function printRecord($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $image, $image2, $image3) { $this->SetFont('Arial','B',12); $ypos = $this->getY() + 5; $this->setY($ypos); $this->Cell (100, 6, "$name ($code)", 0, 0); $this->Cell (30, 6, "\$$price", 0, 1, 'R'); $this->SetFont('Arial','I',10); $this->Cell (130, 6, 'Description', 0, 1); $this->SetFont('Arial','',10); $this->Cell(10); // indent $this->Multicell (90, 4, $desc); $ypos2 = $this->getY(); // end of text if ($image1) { $this->image ($images1, 155, $ypos, 40, 0); $ypos += 35; } if ($image2) { $this->image ($images2, 155, $ypos, 40, 0); $ypos += 35; } if ($image3) { $this->image ($images3, 155, $ypos, 40, 0); $ypos += 35; } $this->setY(max($ypos2, $ypos)); } function printReport() { $sql = sprintf("SELECT * FROM `wares` WHERE A = %d;",$product_id); $res = mysql_query($sql); // while (list($name, $code, $price, $desc, $i1, $i2) = mysql_fetch_row($res)) while (list($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $image, $image2, $image3)= mysql_fetch_row($res)) { //$this->printRecord($name, $code, $price, $desc, $i1, $i2); $this->printRecord($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $image, $image2, $image3); } } } # class //Instantiation of inherited class $pdf=new PDF(); $pdf->Open(); $pdf->setLeftMargin(15); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFillColor(200); $pdf->SetDrawColor(200); $pdf->printReport(); $pdf->output(); ?> the following is my db structure : CREATE TABLE `wares` ( `A` varchar(255) default NULL, `B` varchar(255) default NULL, `C` varchar(255) default NULL, `D` varchar(255) default NULL, `E` varchar(255) default NULL, `F` varchar(255) default NULL, `G` varchar(255) default NULL, `H` varchar(255) default NULL, `I` varchar(255) default NULL, `J` varchar(255) default NULL, `K` varchar(255) default NULL, `L` varchar(255) default NULL, `M` varchar(255) default NULL, `N` varchar(255) default NULL, `O` varchar(255) default NULL, `P` varchar(255) default NULL, `Q` varchar(255) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; can some guru please advise me what to do to accomplish what I want ?Thank you Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-516561 Share on other sites More sharing options...
Barand Posted April 14, 2008 Share Posted April 14, 2008 What error? Really meaningful column names Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-517174 Share on other sites More sharing options...
Alicia Posted April 15, 2008 Author Share Posted April 15, 2008 FPDF error: Image file has no extension and no type was specified: anything woring with my code ? Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-517478 Share on other sites More sharing options...
Barand Posted April 15, 2008 Share Posted April 15, 2008 Can't tell. That would depend on what is in $image1, $image2, $image3. If they end with ".jpg" or ".png" then it should work. Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-517570 Share on other sites More sharing options...
Alicia Posted April 15, 2008 Author Share Posted April 15, 2008 I have updated my script and there is no more error but now it is showing blank page.. can some expert give me an idea what is wrong with my code ? thanks <?php session_start(); include "../includes/dbconn.php"; //define('FPDF_FONTPATH','fpdf/font/'); require('fpdf.php'); class PDF extends FPDF { var $time_printed; // constructor function PDF() { parent::FPDF(); $this->time_printed = date('jS M Y g:i a'); } //Page header function Header() { //Arial bold 15 $this->SetFont('Arial','B',18); //Title $this->Cell(0,20, 'Sample PDF',0,0,'L'); //Line break $this->Ln(15); } //Page footer function Footer() { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial','I',; // time created $this->Cell(40,10,$this->time_printed,0,0,'L'); //Page number $this->Cell(0,10,'Page '.$this->PageNo().' / {nb}',0,0,'C'); } // function printRecord($name, $code, $price, $desc, $im1, $im2) function printRecord($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $image, $image2, $image3) { $this->SetFont('Arial','B',12); $ypos = $this->getY() + 5; $this->setY($ypos); $this->Cell (100, 6, "$name ($code)", 0, 0); $this->Cell (30, 6, "\$$price", 0, 1, 'R'); $this->SetFont('Arial','I',10); $this->Cell (130, 6, 'Description', 0, 1); $this->SetFont('Arial','',10); $this->Cell(10); // indent $this->Multicell (90, 4, $desc); $ypos2 = $this->getY(); // end of text if ($L) { $this->image ($L, 155, $ypos, 40, 0); $ypos += 35; } if ($M) { $this->image ($M, 155, $ypos, 40, 0); $ypos += 35; } if ($N) { $this->image ($N, 155, $ypos, 40, 0); $ypos += 35; } $this->setY(max($ypos2, $ypos)); } function printReport() { //iterate through the cart, the $product_id is the key and $quantity is the value foreach($_SESSION['cart'] as $product_id => $quantity) { $sql = sprintf("SELECT * FROM `wares` WHERE A = %d;",$product_id); $res = mysql_query($sql); // while (list($name, $code, $price, $desc, $i1, $i2) = mysql_fetch_row($res)) list($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $L, $M, $N)= mysql_fetch_array($res); { //$this->printRecord($name, $code, $price, $desc, $i1, $i2); $this->printRecord($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $L, $M, $N); } }//echo "$code <br>"; } // close for loop } # class //Instantiation of inherited class $pdf=new PDF(); $pdf->Open(); $pdf->setLeftMargin(15); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFillColor(200); $pdf->SetDrawColor(200); $pdf->printReport(); $pdf->output(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-517801 Share on other sites More sharing options...
darkfreaks Posted April 15, 2008 Share Posted April 15, 2008 you commented out the echo also "" around the echo not needed <?php session_start(); include "../includes/dbconn.php"; //define('FPDF_FONTPATH','fpdf/font/'); require('fpdf.php'); class PDF extends FPDF { var $time_printed; // constructor function PDF() { parent::FPDF(); $this->time_printed = date('jS M Y g:i a'); } //Page header function Header() { //Arial bold 15 $this->SetFont('Arial','B',18); //Title $this->Cell(0,20, 'Sample PDF',0,0,'L'); //Line break $this->Ln(15); } //Page footer function Footer() { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial','I',; // time created $this->Cell(40,10,$this->time_printed,0,0,'L'); //Page number $this->Cell(0,10,'Page '.$this->PageNo().' / {nb}',0,0,'C'); } // function printRecord($name, $code, $price, $desc, $im1, $im2) function printRecord($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $image, $image2, $image3) { $this->SetFont('Arial','B',12); $ypos = $this->getY() + 5; $this->setY($ypos); $this->Cell (100, 6, "$name ($code)", 0, 0); $this->Cell (30, 6, "\$$price", 0, 1, 'R'); $this->SetFont('Arial','I',10); $this->Cell (130, 6, 'Description', 0, 1); $this->SetFont('Arial','',10); $this->Cell(10); // indent $this->Multicell (90, 4, $desc); $ypos2 = $this->getY(); // end of text if ($L) { $this->image ($L, 155, $ypos, 40, 0); $ypos += 35; } if ($M) { $this->image ($M, 155, $ypos, 40, 0); $ypos += 35; } if ($N) { $this->image ($N, 155, $ypos, 40, 0); $ypos += 35; } $this->setY(max($ypos2, $ypos)); } function printReport() { //iterate through the cart, the $product_id is the key and $quantity is the value foreach($_SESSION['cart'] as $product_id => $quantity) { $sql = sprintf("SELECT * FROM `wares` WHERE A = %d;",$product_id); $res = mysql_query($sql); // while (list($name, $code, $price, $desc, $i1, $i2) = mysql_fetch_row($res)) list($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $L, $M, $N)= mysql_fetch_array($res); { //$this->printRecord($name, $code, $price, $desc, $i1, $i2); $this->printRecord($no, $code, $series, $name, $desc, $price, $G, $H, $I, $J, $k, $L, $M, $N); } }// echo $code; } // close for loop } # class //Instantiation of inherited class $pdf=new PDF(); $pdf->Open(); $pdf->setLeftMargin(15); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFillColor(200); $pdf->SetDrawColor(200); $pdf->printReport(); $pdf->output(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-517814 Share on other sites More sharing options...
Barand Posted April 15, 2008 Share Posted April 15, 2008 Use mysql_fetch_row() with list() And you are creating a pdf, there shouldn't be any "echos" in there. Quote Link to comment https://forums.phpfreaks.com/topic/99860-generate-pdf-in-php-and-mysql/#findComment-517819 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.