prepare pdf-manager setup

This commit is contained in:
arman 2025-02-27 19:40:07 +00:00
parent 890d8a23ff
commit 0ac2969c66
4 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,29 @@
<?
function generate_pdf($template_id=1, $inputs=[]){
$inputs = array($inputs);
$data = array(
'template_id' => $template_id,
'inputs' => $inputs
);
$postfields_json = json_encode($data);
$ch = curl_init();
error_log($postfields_json);
curl_setopt($ch, CURLOPT_URL,"http://10.15.183.210:3000/api/generate_pdf");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Connection: Keep-Alive'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close($ch);
}
?>

View File

@ -67,7 +67,7 @@ echo " </tr>\n";
echo ' <tr>';
echo ' <td><a href="reports.php">' . theme_icon('print/export_reports') . '<br />' . i18n('Print / Export Reports') . '</a></td>';
echo ' <td><a href="reports_ceremony.php">' . theme_icon('print_awards_ceremony_scripts') . '<br />' . i18n('Print Award Ceremony Scripts') . '</a></td>';
//echo ' <td><a href="reports_editor.php">' . theme_icon('report_management') . '<br />' . i18n('Report Management') . '</a></td>';
echo ' <td><a href="reports_editor.php">' . theme_icon('report_management') . '<br />' . i18n('Report Management') . '</a></td>';
//echo ' <td><a href="translations.php">' . theme_icon('translations_management') . '<br />' . i18n('Translations Management') . '</a></td>';
echo '</td>';

View File

@ -37,6 +37,7 @@
require_once("reports_tours.inc.php");
require_once("reports_fairs.inc.php");
require_once("reports_fundraising.inc.php");
require_once("helper_functions.inc.php");
//require_once('../lpdf.php');
require_once('../lcsv.php');
@ -628,6 +629,12 @@ foreach($report['col'] as $v)
break;
case 'pdf': case '':
/* FIXME: handle landscape pages in here */
$inputs = array(
"fairname" => i18n($config['fairname']),
);
generate_pdf($_GET['id'], $inputs);
$label_stock = $report_stock[$report['option']['stock']];
$rep=new lpdf( i18n($config['fairname']),
i18n($report['name']),

View File

@ -38,7 +38,7 @@ require_once ('reports_tours.inc.php');
require_once ('reports_fairs.inc.php');
require_once ('reports_fundraising.inc.php');
require_once ('reports.inc.php');
require_once ('../tcpdf.inc.php');
// require_once ('../tcpdf.inc.php');
$fields = array();
$locs = array('X' => 'x', 'Y' => 'y', 'W' => 'w', 'H' => 'h', 'Lines' => 'lines');