add api/project/signatureform API

This commit is contained in:
james 2011-02-21 22:07:06 +00:00
parent 8aaff3cbd7
commit 8d7eb7ca72
4 changed files with 24 additions and 8 deletions

16
api.php
View File

@ -1073,6 +1073,22 @@ switch($request[0]) {
}
break;
/* APIDOC: project/signatureform
description(generate and download the signature page PDF for the currently logged in user/project, as a BASE64 ENCODED string)
return(pdf base64 encoded string)
*/
case 'signatureform':
ob_start();
//this tells it to simply return the [S]tring instead of outputting headers to force pdf display in a browser
$PDFDEST="S";
include "register_participants_signature.php";
$c=ob_get_contents();
ob_end_clean();
$b64=base64_encode($c);
$ret['status']="ok";
$ret['pdf']=$b64;
break;
default:
$ret['status']="error";
$ret['error']="invalid project API command ({$request[1]})";

View File

@ -191,10 +191,10 @@ echo "<table><tr><td>";
echo "</td></tr>";
//FIXME: this should be a global detection so we can use the results elsewhere, especially for all the reports!
if(function_exists("pdf_new"))
if(file_exists("tcpdf/tcpdf.php"))
$sigfile="register_participants_signature.php";
else if(file_exists("tcpdf/tcpdf.php"))
$sigfile="register_participants_signature_tcpdf.php";
else if(function_exists("pdf_new"))
$sigfile="register_participants_signature_pdflib.php";
else
$sigfile="";

View File

@ -64,8 +64,6 @@
}
//END OF AUTH, now lets try to generate a PDF using only PHP :) this should be fun!
$pdf=new pdf( "Participant Signature Page ($registration_number)" );
$pdf->setFontSize(11);
@ -215,5 +213,8 @@ function sig($pdf, $text)
$pdf->WriteHTML("<br><hr>");
}
echo $pdf->output();
if(isset($PDFDEST))
echo $pdf->output('',$PDFDEST);
else
echo $pdf->output();
?>

View File

@ -538,8 +538,7 @@ class pdf extends TCPDF {
$filename=strtolower($this->subject);
$filename=ereg_replace("[^a-z0-9]","_",$filename).'.pdf';
}
parent::Output($filename, $dest);
return parent::Output($filename, $dest);
}
}