Hi All,
I am trying to generate a membership card that our members can print out and carry with them.
I can create the card, populate it with name and expire date from database and view it fine with this code:
<?php
include_once 'includes/auth.php';
include 'includes/dbconnect.php';
?>
<style type="text/css">
<!--
#container {
width: 352px;
height:200px;
background-image: url(http://mywebsite.org/members/images/membership-card-bg.jpg);
background-repeat:no-repeat;
}
.card-font {
font-size:12px;
}
-->
</style></head>
<body>
<?php
// Get member information
$username = $_SESSION['username'];
$result = mysql_query("SELECT * FROM members WHERE EMAIL = '$username' LIMIT 1");
$row = mysql_fetch_array($result) or die(mysql_error());
?>
<div id="container">
<table width="350" height="195" border="0">
<tr>
<td height="141" colspan="2"> </td>
</tr>
<tr>
<td width="21" height="21" class="card-font"> </td>
<td width="319" class="card-font"><strong>Member Name:</strong> <?php print "$row[FIRST_NAME]"; ?><?php print " $row[LAST_NAME]"; ?></td>
</tr>
<tr>
<td height="25" class="card-font"> </td>
<td height="25" class="card-font"><strong>Valid Through:</strong> <?php print "$row[PAID_THRU]"; ?></td>
</tr>
</table></div>
<p > </p>
</body>
</html>
BUT, the background does not print. So I am now trying to convert the above into a pdf, then print the new pdf with background intact. I am using DOMPDF (http://www.digitaljunkies.ca/dompdf) and I did get it working fine with a test image.
My question is how can I enter the code above where they want it (code below) where it defines $html
<?php
require_once("dompdf_config.inc.php");
include_once '../../members/includes/auth.php';
include '../../members/includes/dbconnect.php';
// Get member information
$username = $_SESSION['username'];
$result = mysql_query("SELECT * FROM members WHERE EMAIL = '$username' LIMIT 1");
$row = mysql_fetch_array($result) or die(mysql_error());
$html =
'<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("Membership-Card.pdf");
?>
Thank you for any help!
Scott