greenpoise Posted May 21, 2009 Share Posted May 21, 2009 Ok . I am new to PHP really. I have looked so many places with no luck. My code below does not return any errors but it does not return anything on the browser either. Basically it pulls rows from a sql query and I want to display a page in pdf. I have done it with html/css but it does not print as laid in the screen and that is a must for me. Leads?? thanks in advance <?php require_once("classes/model/class.AbstractModel.php"); require_once ("classes/sessions/class.Controller.php"); require_once ("classes/model/class.ManualModel.php"); require_once ("classes/model/class.Tx.php"); require_once ("classes/sessions/class.Request.php"); require_once ("classes/sessions/class.UserSession.php"); require_once ("classes/html2pdf/html2fpdf.php"); class TransmittalReport extends Controller { function TransmittalReport() { } function _default_action() { $this->display(); } function display (){ $db = Database::getInstance(); $thisTx =& Tx::getCurrent (); $query = "SELECT * FROM txcontent_report_view where tx_id = ".$thisTx->get_tx_id(); $query2 = "SELECT * FROM contents_view where tx_id = ".$thisTx->get_tx_id(); $result = pg_query($query); $result2 = pg_query($query2); while($myrow = pg_fetch_assoc($result)) { $contactname = $myrow["contact_name"]; $projectname = $myrow["project_name"]; $HTML = " <HTML> <BODY> <TABLE BORDER=\"1\" WIDHT=\"700\"> <TR><TD BGCOLOR=\"#00FF00\"><B>Name</B></TD><TD WIDTH=\"240\">'.$contactname.'</TD></TR> <TR><TD BGCOLOR=\"#FF0000\"><B>From</B></TD><TD>'.$projectname.'</TD></TR> </TABLE> </BODY> </HTML> ";return $HTML; $pdf = new HTML2FPDF(); $pdf->HTML2FPDF("P","mm","A4"); $pdf->AddPage(); $pdf->WriteHTML($HTML); $pdf->Output("transform.pdf"); } } }?> Link to comment https://forums.phpfreaks.com/topic/159129-html2pdf-help/ Share on other sites More sharing options...
greenpoise Posted May 21, 2009 Author Share Posted May 21, 2009 One more thing, I would like to know if I can add/import a css stylesheet to the code and how. Thanks Link to comment https://forums.phpfreaks.com/topic/159129-html2pdf-help/#findComment-839192 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.