yii2tech / html2pdf

Yii2 component for HTML to PDF conversion
Other
78 stars 65 forks source link

Pass PDF options to template on the render function #14

Closed troncz closed 6 years ago

troncz commented 6 years ago

The PDF options were not available as a parameter on the render command. This simple change fixes that.

klimov-paul commented 6 years ago

This change makes no sense: PDF options has nothing to do with the view template rendering, which operates HTML only. If you wish to operate Template::$pdfOptions, you should do it using Template instance, instead adjusting render() method:

$template->pdfOptions = [...];
$template->render(...);
troncz commented 6 years ago

Thanks for the fast feedback. I am using Dompdf and need the setBasePath option of that library to get the rendered html to work properly with the site CSS files. Seems logical to me that even when rendering HTML only it is somethings required to set the $pdfOptions for the converter. I will use your suggestion but that still seems weird to me since I will basically copy your render() method.