Hello I have a little problem to generate pdf ... I'm using DOMPDF and HTML2PDF my basic example ... the example works in Windows but in Debian doesn't work
my steps were as follows
phalcon create-project phalconpdf
.- require dompdf in composer.
- register Classes dompdf and html2pdf.
<?php
$loader = new \Phalcon\Loader();
/**
* We're a registering a set of directories taken from the configuration file
*/
$loader->registerDirs(
array(
$config->application->controllersDir,
$config->application->modelsDir,
$config->application->libraryDir,
)
)
->registerClasses(
array(
"domPdf" => "/../../vendor/dompdf/dompdf/dompdf_config.inc.php",
"html2Pdf" => "/../../vendor/html2pdf/html2pdf.class.php"
)
)
->register();
// Use composer autoloader to load vendor classes
require_once __DIR__ . '/../../vendor/autoload.php';
in the IndexController i have
<?php
class IndexController extends ControllerBase
{
public function dompdfAction()
{
$this->view->disable();
$html = $this->view->getRender("index","dompdf");
$dompdf = new domPdf;
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("exampledom.pdf");
}
public function html2pdfAction(){
$this->view->disable();
$content = $this->view->getRender("index","html2pdf");
$html2pdf = new html2Pdf('P','A4','fr');
$html2pdf->WriteHTML($content);
$html2pdf->Output('exemplehtml.pdf');
}
}
and my views are
// views/index/dompdf.volt
<h1>DOMPDF</h1>
<article>
Phalcon is an open source, full stack framework for PHP written as a C-extension, optimized for high performance. You don’t need to learn or use the C language, since the functionality is exposed as PHP classes ready for you to use. Phalcon also is loosely coupled, allowing you to use its objects as glue components based on the needs of your application.
</article>
// views/index/html2pdf.volt
<h1>HTML2PDF</h1>
<p>
Phalcon is an open source, full stack framework for PHP written as a C-extension, optimized for high performance. You don’t need to learn or use the C language, since the functionality is exposed as PHP classes ready for you to use. Phalcon also is loosely coupled, allowing you to use its objects as glue components based on the needs of your application.
</p>
what is problem?