<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  
  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/pmafresh/public_html/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records from 'delegates'
  //list($delegatesRecords, $delegatesMetaData) = getRecords(array(
  //  'tableName'   => 'delegates',
  //  'loadUploads' => true,
  //  'allowSearch' => false,
  //));

?>
<?php 
	$GLOBALS['CREATEPDF_CUSTOM_SWITCHES'] = '--orientation landscape --margin-left 0 --margin-top 0 --margin-right 0 --margin-bottom 0';
	createPDF_fromOutput('inline', 'example.pdf');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <style type="text/css">
	*{ 
	-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
	-moz-box-sizing: border-box;    /* Firefox, other Gecko */
	box-sizing: border-box;         /* Opera/IE 8+ */
	}
	body { margin: 0;}
	body{font-family: arial; }
	
	.item{ 
		width: 297.64pt;
		height: 429.95pt;
		display: inline-block;
		position: relative;
		text-align: center;
		background:#f00;
		text-align: center;
	}
	
	.label{
		display: block;
		position: absolute;
		top: 114.33pt;
		left:37.155pt;
		width: 223.94pt;
		height: 218.27pt;
		padding: 17pt;
		margin: 0 auto;
		background: white;
	}
	
	.name      {display: block; position: relative; width: 100%; height: 1em; font-size: 16pt;font-weight: bold; margin-bottom: 1em;}
	.company   {display: block; position: relative; width: 100%; height: 1em; font-size: 14pt;font-weight: normal;margin-bottom: 1em;}
	.qrc       { width: 72.28pt; height: 72.28pt; position: absolute; bottom: 17pt; left: 75.83pt;}
	.qrc img   { width: 100%; height: 100%; position: relative; margin: 0;}
	
  </style>
 </head>
<body>



    <?php $count=0 ?>
    <?php while ($count != 8): $count++; ?>
    <div class="item">
	    <div class="label">
	      <div class="name"><?php echo htmlencode($record['first_name']) ?> <?php echo htmlencode($record['last_name']) ?></div>
	      <div class="company"><?php echo htmlencode($record['company']) ?></div>
			<div class="qrc">
			<?php
			  echo qrCode(array(
			    'type'      => 'contact',
			    'firstName' => 'John',
			    'lastName'  => 'Smith',
			    'address'   => '1233 Main St, Central City, State, USA',
			    'phone'     => '555-555-5555',
			    'email'     => 'user@example.com'
			  ));
			?>
			</div>
	    </div>
    </div>
<?php if ($count == '4'): ?><div style="page-break-after:always"></div><?php $count=1 ?>  
<?php else: ?><?php $count++ ?>
<?php endif ?>     

<?php endwhile; ?>

</body>
</html>
