如何仅在mPDF中显示图形而不显示表格?

I've been using jpgraph library to generate graphs in mdf. The problem i'm facing is that i don't want to show table values but only the graph. Since in the following example it shows both. http://mpdf1.com/manual/index.php?tid=364 Is there any way to do this? Plase help.

Thanks!

<?php

include("../mpdf.php");

// This must be defined before including mpdf.php file
define("_JPGRAPH_PATH", '../../jpgraph_5/src/'); 

// Change these if necessary to the name of font files you can access from JPGraph
define("_TTF_FONT_NORMAL", 'arial.ttf');
define("_TTF_FONT_BOLD", 'arialbd.ttf');

$mpdf=new mPDF(); 

// This must be set to allow mPDF to parse table data
$mpdf->useGraphs = true;

$html = '
<table id="tbl_1"><tbody>
<tr><td></td><td><b>Female</b></td><td><b>Male</b></td></tr>
<tr><td>35 - 44</td><td><b>4</b></td><td><b>2</b></td></tr>
<tr><td>45 - 54</td><td><b>5</b></td><td><b>7</b></td></tr>
<tr><td>55 - 64</td><td><b>21</b></td><td><b>18</b></td></tr>
<tr><td>65 - 74</td><td><b>11</b></td><td><b>14</b></td></tr>
<tr><td>75 - 84</td><td><b>10</b></td><td><b>10</b></td></tr>
<tr><td>85 - 94</td><td><b>2</b></td><td><b>1</b></td></tr>
<tr><td>95 - 104</td><td><b>1</b></td><td><b></b></td></tr>
<tr><td>TOTAL</td><td>54</td><td>52</td></tr>
</tbody></table>

<jpgraph table="tbl_1" type="bar" title="New subscriptions" label-y="% patients" label-x="Age group" series="cols" data-row-end="-1" show-values="1" width="600" legend-overlap="1" hide-grid="1" hide-y-axis="1" />
';

$mpdf->WriteHTML($html);
$mpdf->Output();
exit;

?>

Change your Table like this:

<table id="tbl_1" style="display:none">

Try giving classes to the elements you want to hide and control them in a separate style sheet solely for the PDF.

$html = "<body><div class='hide-this'></div></body>";

Declare a style sheet with media="print":

<link rel="stylesheet" type="text/css" href="pdf.css" media="print">

In the style sheet:

.hide-this{
     display: none;
}

Note that display only works on block level elements in mPDF.

Use following code

include("../mpdf.php");
$mpdf=new mPDF(); 

$graphLink = 'graphPage.php?id=1'; // create a new file, you can pass parameter to it also.
$html .= '<div><img src="'.$graphLink.'" ></div>';
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;

Code for "graphPage.php"

// graphPage.php
include_once("../PATH_TO_JPGRAPH/src/jpgraph.php"); 
require_once ('../PATH_TO_JPGRAPH/src/jpgraph_bar.php');

$id = (int)$_GET['id'];
$data1y=array(47,80,40,116);
$data2y=array(61,30,82,105);
$data3y=array(115,50,70,93);

// Create the graph. These two calls are always required
$graph = new Graph(350,200,'auto');
$graph->SetScale("textlin");


$graph->yaxis->SetTickPositions(array(0,30,60,90,120,150), array(15,45,75,105,135));
$graph->SetBox(false);
$graph->SetFrame(false);
$graph->SetFrameBevel(1,false,'#ffffff','#ffffff','#ffffff');

$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels(array('A','B','C','D'));

$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

// Create the bar plots
$b1plot = new BarPlot($data1y);
$b2plot = new BarPlot($data2y);
$b3plot = new BarPlot($data3y);

// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot,$b3plot));
// ...and add it to the graPH
$graph->Add($gbplot);


$b1plot->SetColor("white");
$b1plot->SetFillColor("#95c11f");

$b2plot->SetColor("white");
$b2plot->SetFillColor("#11cccc");

$b3plot->SetColor("white");
$b3plot->SetFillColor("#1111cc");

$graph->title->Set("My Bar Graph");

// Display the graph
$graph->Stroke();