コード例 #1
0
ファイル: index.php プロジェクト: BellyWong/FreeApiPrint
 }
 if ($md5 === null) {
     $response->sendCallError('URL ou contenu manquant');
 }
 // Start print to PDF : get an older print if it exists
 try {
     $api_print = ApiPrint::retrieveByUserAndMd5($api_user, $md5);
 } catch (Exception $e) {
     $response->sendCallError('Impossible to get content');
 }
 // New print...
 if ($api_print === null) {
     $api_print = new ApiPrint();
     $api_print->setIdUser($api_user->getId());
     if ($url !== null) {
         $api_print->setUrl($url);
     } elseif ($content !== null) {
         $api_print->setContent($content);
     } else {
         $response->sendDisastrousError('Logical error : no content, no url');
     }
     $api_print->setMd5($md5);
     $api_print->setNb(0);
 }
 // Print to PDF
 try {
     // Check the options
     if (isset($_POST['options']) === true && is_array($_POST['options']) === true) {
         $options = $_POST['options'];
     }
     $pdf = $api_print->printPage($options);