Files
ExpenseCount/app/webroot/pre_pdf.php
2026-06-25 13:03:45 +06:00

32 lines
6.8 KiB
PHP

<?php
$html = '<b>Test</b><svg version="1.1" class="highcharts-root" style="font-family:&quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, Arial, Helvetica, sans-serif;font-size:12px;" xmlns="http://www.w3.org/2000/svg" width="540" height="280" viewBox="0 0 540 280"><desc>Created with Highcharts 7.0.3</desc><defs><clipPath id="highcharts-8r1q3yt-4"><rect x="0" y="0" width="300" height="212" fill="none"></rect></clipPath></defs><rect fill="#ffffff" class="highcharts-background" x="0" y="0" width="540" height="280" rx="0" ry="0"></rect><rect fill="none" class="highcharts-plot-background" x="10" y="53" width="300" height="212"></rect><rect fill="none" class="highcharts-plot-border" data-z-index="1" x="10" y="53" width="300" height="212"></rect><g class="highcharts-series-group" data-z-index="3"><g data-z-index="0.1" class="highcharts-series highcharts-series-0 highcharts-pie-series highcharts-tracker" transform="translate(10,53) scale(1 1)" style="cursor:pointer;"><path fill="#7cb5ec" d="M 149.98441899991732 17.000001586716124 A 76.5 76.5 0 0 1 216.27383467822744 131.7103236971761 L 150 93.5 A 0 0 0 0 0 150 93.5 Z" transform="translate(0,0)" stroke="#ffffff" stroke-width="1" stroke-linejoin="round" class="highcharts-point highcharts-color-0"></path><path fill="#434348" d="M 216.23559122398407 131.77657841564843 A 76.5 76.5 0 0 1 83.78710515852815 131.8158264521619 L 150 93.5 A 0 0 0 0 0 150 93.5 Z" transform="translate(0,0)" stroke="#ffffff" stroke-width="1" stroke-linejoin="round" class="highcharts-point highcharts-color-1"></path><path fill="#90ed7d" d="M 83.74882244490662 131.74959441044427 A 76.5 76.5 0 0 1 149.89374303473753 17.000073794432097 L 150 93.5 A 0 0 0 0 0 150 93.5 Z" transform="translate(0,0)" stroke="#ffffff" stroke-width="1" stroke-linejoin="round" class="highcharts-point highcharts-color-2"></path></g><g data-z-index="0.1" class="highcharts-markers highcharts-series-0 highcharts-pie-series " transform="translate(10,53) scale(1 1)"></g></g><text x="270" text-anchor="middle" class="highcharts-title" data-z-index="4" style="color:#333333;font-size:18px;fill:#333333;" y="24"><tspan>Participant wise expense ratio</tspan></text><text x="270" text-anchor="middle" class="highcharts-subtitle" data-z-index="4" style="color:#666666;fill:#666666;" y="52"></text><g data-z-index="6" class="highcharts-data-labels highcharts-series-0 highcharts-pie-series highcharts-tracker" transform="translate(10,53) scale(1 1)" opacity="1" style="cursor:pointer;"><path fill="none" class="highcharts-data-label-connector highcharts-color-0" stroke="#7cb5ec" stroke-width="1" d="M 247.23170550304275 40.25000000000002 C 242.23170550304275 40.25000000000002 226.64324823492282 49.250000000000014 221.4470958122162 52.250000000000014 L 216.25094338950956 55.250000000000014"></path><path fill="none" class="highcharts-data-label-connector highcharts-color-1" stroke="#434348" stroke-width="1" d="M 145 200 C 150 200 149.99999999999997 182 149.99999999999997 176 L 149.99999999999997 170"></path><path fill="none" class="highcharts-data-label-connector highcharts-color-2" stroke="#90ed7d" stroke-width="1" d="M 52.768294496957296 40.249999999999986 C 57.768294496957296 40.249999999999986 73.35675176507718 49.24999999999999 78.55290418778381 52.24999999999999 L 83.74905661049044 55.24999999999999"></path><g class="highcharts-label highcharts-data-label highcharts-data-label-color-0 " data-z-index="1" transform="translate(252,30)"><text x="5" data-z-index="1" style="font-size:11px;font-weight:bold;color:#000000;cursor:pointer;fill:#000000;" y="16"><tspan style="font-weight: bold;" x="5" y="16" class="highcharts-text-outline" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="2px" stroke-linejoin="round">33.3%</tspan><tspan style="font-weight:bold" x="5" y="16">33.3%</tspan></text></g><g class="highcharts-label highcharts-data-label highcharts-data-label-color-1 " data-z-index="1" transform="translate(96,190)"><text x="5" data-z-index="1" style="font-size:11px;font-weight:bold;color:#000000;cursor:pointer;fill:#000000;" y="16"><tspan style="font-weight:bold" x="5" y="16" class="highcharts-text-outline" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="2px" stroke-linejoin="round">33.3%</tspan><tspan style="font-weight:bold" x="5" y="16">33.3%</tspan></text></g><g class="highcharts-label highcharts-data-label highcharts-data-label-color-2 " data-z-index="1" transform="translate(4,30)"><text x="5" data-z-index="1" style="font-size:11px;font-weight:bold;color:#000000;cursor:pointer;fill:#000000;" y="16"><tspan style="font-weight:bold" x="5" y="16" class="highcharts-text-outline" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="2px" stroke-linejoin="round">33.3%</tspan><tspan style="font-weight:bold" x="5" y="16">33.3%</tspan></text></g></g><g class="highcharts-legend" data-z-index="7" transform="translate(322,114)"><rect fill="none" class="highcharts-legend-box" rx="0" ry="0" x="0" y="0" width="208" height="47" visibility="visible"></rect><g data-z-index="1"><g><g class="highcharts-legend-item highcharts-pie-series highcharts-color-0" data-z-index="1" transform="translate(8,3)"><text x="15" style="color:#333333;cursor:pointer;font-size:12px;font-weight:bold;fill:#333333;" text-anchor="start" data-z-index="2" y="15"><tspan>Ajit</tspan></text><rect x="0" y="6" width="10" height="10" fill="#7cb5ec" rx="5" ry="5" class="highcharts-point" data-z-index="3"></rect></g><g class="highcharts-legend-item highcharts-pie-series highcharts-color-1" data-z-index="1" transform="translate(108,3)"><text x="15" y="15" style="color:#333333;cursor:pointer;font-size:12px;font-weight:bold;fill:#333333;" text-anchor="start" data-z-index="2"><tspan>Imran</tspan></text><rect x="0" y="6" width="10" height="10" fill="#434348" rx="5" ry="5" class="highcharts-point" data-z-index="3"></rect></g><g class="highcharts-legend-item highcharts-pie-series highcharts-color-2" data-z-index="1" transform="translate(8,21)"><text x="15" y="15" style="color:#333333;cursor:pointer;font-size:12px;font-weight:bold;fill:#333333;" text-anchor="start" data-z-index="2"><tspan>sunny</tspan></text><rect x="0" y="6" width="10" height="10" fill="#90ed7d" rx="5" ry="5" class="highcharts-point" data-z-index="3"></rect></g></g></g></g></svg>';
//echo $html;exit;
require("../../lib/mpdf60/mpdf.php");
//$html = $this->request->data['whole_content'];
// pr($html); die;
$mpdf = new mPDF();
$mpdf->SetProtection(array("print"));
$stylesheet = file_get_contents(CDN_URL.'css/print_report.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html, 2);
$rand = rand(1000, 10000);
$reportUrl = "reports/";
if(!is_dir($reportUrl)){
mkdir($reportUrl,0777,true);
}
$filename = $reportUrl.$rand."_".time()."_"."expenses.pdf";
// echo $html; die;
$mpdf->Output($filename);
if (file_exists($filename)) {
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename='.$filename);
readfile($filename);
@unlink($filename);
exit;
}
?>