1. Go to this page and download the library: Download lukyrys/pdf-response library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
public function actionPdf()
{
$template = $this->createTemplate();
$template->setFile("/path/to/template.latte");
$pdf = new Joseki\Application\Responses\PdfResponse($template);
$pdf->save("/path/to/directory"); // as a filename $this->documentTitle will be used
$pdf->save("/path/to/directory", "filename"); // OR use a custom name
}
public function actionPdf()
{
$template = $this->createTemplate();
$template->setFile("/path/to/template.latte");
$pdf = new Joseki\Application\Responses\PdfResponse($template);
$savedFile = $pdf->save("/path/to/directory");
$mail = new Nette\Mail\Message;
$mail->addTo("[email protected]");
$mail->addAttachment($savedFile);
$mailer = new SendmailMailer();
$mailer->send($mail);
}
public function actionPdf()
{
$template = $this->createTemplate();
$template->setFile("/path/to/template.latte");
$pdf = new Joseki\Application\Responses\PdfResponse($template);
$pdf->setSaveMode(PdfResponse::DOWNLOAD); //default behavior
$this->sendResponse($pdf);
}
public function actionPdf()
{
$template = $this->createTemplate();
$template->setFile("/path/to/template.latte");
$pdf = new Joseki\Application\Responses\PdfResponse($template);
$pdf->setSaveMode(PdfResponse::INLINE);
$this->sendResponse($pdf);
}
public function actionPdf()
{
$pdf = new Joseki\Application\Responses\PdfResponse('');
$pdf->setBackgroundTemplate("/path/to/an/existing/file.pdf");
// to write into an existing document use the following statements
$mpdf = $pdf->getMPDF();
$mpdf->WriteFixedPosHTML('hello world', 1, 10, 10, 10);
// to write to another page
$mpdf->AddPage();
// to move to exact page, use
$mpdf->page = 3; // = move to 3rd page
$this->sendResponse($pdf);
}
public function actionPdf()
{
$latte = new Latte\Engine;
$latte->setTempDirectory('/path/to/cache');
$latte->addFilter('money', function($val) { return ...; }); // formerly registerHelper()
$latte->onCompile[] = function($latte) {
$latte->addMacro(...); // when you want add some own macros, see http://goo.gl/d5A1u2
};
$template = $latte->renderToString("/path/to/template.latte");
$pdf = new Joseki\Application\Responses\PdfResponse($template);
$this->sendResponse($pdf);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.