Closed vkponomarev closed 4 years ago
You can convert any string to PDF using \yii2tech\html2pdf\Manager::convert()
:
class PrintController extends Controller
{
public function actionPrint()
{
$this->layout = "print";
$html = $this->render('some-view', []);
Yii::$app->html2pdf
->convert($html)
->saveAs('/path/to/output.pdf');
}
Although it has no sense for me. It is better to use \yii2tech\html2pdf\Manager::render()
directly over the view:
class PrintController extends Controller
{
public function actionPrint()
{
Yii::$app->html2pdf
->render('some-view')
->saveAs('/path/to/output.pdf');
}
Is there are posibility to convert html page that generates from controller/view with css and other like in mPDF
i have page: site.com/page/
how can i generate pdf from this page
mPDF its like this:
or u can save it to file.
html2pdf can do like this?