$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); $api_print->save(); } catch (Exception $e) { $response->sendTransformError($e->getMessage()); } // Send PDF $response->setContent($pdf, true); $response->setDownloadHeader('transform.pdf'); $response->send(); } catch (Exception $e) { if (DEBUG) { $response->sendDisastrousError($e->getMessage()); } else { $response->sendDisastrousError(); } }