Class mPDF + file_get_contents

0

I have the following code to generate a PDF file and I want to use file_get_contents to include a graph and a table that are generated dynamically on another page but the result is not what I expected.

The code with the class mPDF:

<?php 
#--> inclui class 
include("mpdf.php"); 
#--> $mpdf=new mPDF('utf-8', 'A4-L');
#--> header
$mpdf->SetHTMLHeader('
<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 14pt; color: #000000; font-weight: bold; border-bottom:0.5mm solid #220044;">
<tr>
    <td width="50%"><span style="font-weight: bold;">Titulo Header</span></td>
    <td width="45%" style="text-align: right;"><span style="font-size: 9pt;">Subtitulo<br /></span></td>
    <td width="5%" style="text-align: right;"><img src="imagens/img_logo.png" width="60" height="35" /></td>
</tr>
</table>
');
#--> page
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
$mpdf->AddPage('L'); // Adds a new page in Landscape orientation
$mpdf->WriteHTML('
<body style="background-gradient: linear #CCCCCC #FFFFFF 0 0.5 1 0.5;">
');
$mpdf->WriteHTML(file_get_contents('conteudo/pagina1.php'));
#--> footer
$mpdf->SetHTMLFooter('
<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;">
<tr>
    <td width="33%"><span style="font-weight: bold; font-style: italic;">Titulo Footer 1</span></td>
    <td width="33%" align="center" style="font-weight: bold; font-style: italic;">{PAGENO}/{nbpg}</td>
    <td width="33%" style="text-align: right; ">Titulo Footer 2</td>
</tr>
</table>
');
#-->
$mpdf->Output();
?>

Thecodeonpage1.php

<?php#-->errroserror_reporting(0);#-->incluiconexaomysqlrequire_once('../../Connections/conn.php');#-->incluifusionchartsinclude('../../includes/FusionCharts/dynamic/DWFChart.inc.php');#-->fusionchart#PDFGrafico9dataincludeinclude('../../includes/FusionCharts/dynamic/data/fc_PDFGrafico9_data.php');#-->consultagraficomysql_select_db($database_conn,$conn);$query_Reporrt1Grf="SELECT * FROM sys_report1";
$Reporrt1Grf = mysql_query($query_Reporrt1Grf, $conn) or die(mysql_error());
$row_Reporrt1Grf = mysql_fetch_assoc($Reporrt1Grf);
$totalRows_Reporrt1Grf = mysql_num_rows($Reporrt1Grf);
#--> consulta tabela
mysql_select_db($database_conn, $conn);
$query_Report1 = "SELECT * FROM sys_report1";
$Report1 = mysql_query($query_Report1, $conn) or die(mysql_error());
$row_Report1 = mysql_fetch_assoc($Report1);
$totalRows_Report1 = mysql_num_rows($Report1);
#--> fusion chart #PDFGrafico9 dynamic filter data
$dFCPDFGrafico9 = new DWFChart("PDFGrafico9", "MSStackedColumn2DLineDY", "../../includes/FusionCharts/charts/", 800, 400, "", "", "", "", "", "");
$dFCPDFGrafico9->setVersion("1.1.1");
$dFCPDFGrafico9->setConfigXML($PDFGrafico9_dataXML);
$dFCPDFGrafico9->setCategory($Reporrt1Grf, "col1", "", "");
$dFCPDFGrafico9->addSeries($Reporrt1Grf,  "col2", "", "color='ff' seriesName='col2' renderAs='Column'", "Group 1", "");
$dFCPDFGrafico9->addSeries($Reporrt1Grf,  "col6", "", "color='ff6600' seriesName='col6' renderAs='Column'", "Group 2", "");
$dFCPDFGrafico9->addSeries($Reporrt1Grf,  "col4", "", "color='33ff00' seriesName='col4' renderAs='Line'", "Group 3", "");
$dFCPDFGrafico9->setOrdering('None', 'asc');
$dFCPDFGrafico9->prepareData(); 
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../../css/stylo.css"/>
<title>Untitled Document</title>
<script type="text/javascript" 
<src="../../includes/FusionCharts/dynamic/js/FusionCharts.js"></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="50">&nbsp;</td>
  </tr>
  <tr>
    <td align="center" valign="middle">
    <?php
    // (FCChart Begin) #PDFGrafico9
    renderFusionChart($dFCPDFGrafico9, 800, 400);
    // #PDFGrafico9 (FCChart End)
    ?>
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr class="tableHeader1a">
      <td rowspan="2" class="tableHeader1d">col1</td>
      <td height="25" colspan="4" class="tableHeader1d tableHeader1e">col A</td>
      <td height="25" colspan="3" class="tableHeader1d tableHeader1e">col B</td>
      <td rowspan="2">col9</td>
    </tr>
    <tr class="tableHeader1a">
      <td height="25" class="tableHeader1c">col2</td>
      <td height="25" class="tableHeader1c">col3</td>
      <td height="25" class="tableHeader1c">col4</td>
      <td height="25" class="tableHeader1d">col5</td>
      <td height="25" class="tableHeader1c">col6</td>
      <td height="25" class="tableHeader1c">col7</td>
      <td height="25" class="tableHeader1d">col8</td>
    </tr>
    <?php do { ?>
      <tr class="tableDesc1a" bgcolor="<?php echo ($ac_sw1++%2==0)?"#FFFFFF":"#EBEBEB"; ?>">
        <td height="25" class="tableDesc1c"><?php echo $row_Report1['col1']; ?></td>
        <td height="25" class="tableDesc1b"><?php echo $row_Report1['col2']; ?></td>
        <td height="25" class="tableDesc1b"><?php echo $row_Report1['col3']; ?></td>
        <td height="25" class="tableDesc1b"><?php echo $row_Report1['col4']; ?></td>
        <td height="25" class="tableDesc1c"><?php echo $row_Report1['col5']; ?></td>
        <td height="25" class="tableDesc1b"><?php echo $row_Report1['col6']; ?></td>
        <td height="25" class="tableDesc1b"><?php echo $row_Report1['col7']; ?></td>
        <td height="25" class="tableDesc1c"><?php echo $row_Report1['col8']; ?></td>
        <td height="25"><?php echo $row_Report1['col9']; ?></td>
      </tr>
      <?php } while ($row_Report1 = mysql_fetch_assoc($Report1)); ?>
</table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($Reporrt1Grf);
mysql_free_result($Report1);
?>

Any suggestions?

Thank you.

    
asked by anonymous 01.09.2015 / 15:06

0 answers