How to use dompdf in magento
-
29-09-2020 - |
سؤال
I am trying to use dompdf in magento for printing invoice.
So I am trying to include dompdf in magento but its not working.
I used following code in Mage.php
before include_once "Varien/Autoload.php";
.
include_once 'dompdf/autoload.inc.php';
spl_autoload_register('DOMPDF_autoload');
Its giving blank page.
Any help.
المحلول
I used code like
<?php
use Dompdf\Adapter\CPDF;
use Dompdf\Dompdf;
use Dompdf\Exception;
class Practice_ControllerTest_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
require_once 'dompdf/autoload.inc.php';
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
$dompdf->stream();
}
}
It works for me
لا تنتمي إلى magento.stackexchange