Use from console commands

You can also create PDFs from console commands through the low-level PdfFile class.
The following example is taken from the example module:

publicfunctionactionIndex($filename) {$pdf=newPdfFile;// We have to set some paths ...$pdf->baseViewPath=Yii::getPathOfAlias('ext.pdfable.pdfable.views');$pdf->layoutPath=Yii::getPathOfAlias('ext.pdfable.pdfable.views.layouts');$pdf->viewPath=Yii::getPathOfAlias('ext.pdfable.pdfable.views.demo');// ... and supply our custom CSS file$pdf->setOptions(array('user-style-sheet'=>Yii::getPathOfAlias('ext.pdfable.pdfable.assets.css.pdf').'.css', ));$pdf->renderPage('invoice');$pdf->renderPage('page1');$pdf->renderPage('page2');$pdf->saveAs($filename); }

If you want to try the example command you can add it to the commandMap in your console.php:

Override hardcoded page defaults

The behavior uses some hardcoded defaults for document and page options (see PdfFile).
Your configuration above will always be merged with these defaults. If you don't like
this and want complete freedom instead, then configure the behavior like this:

<?phppublicfunctionbehaviors() {returnarray('pdfable'=>array('class'=>'ext.pdfable.Pdfable','defaultPdfOptions'=>array(...// default PDF options here// could also be an empty array to disable all defaults... ),'defaultPdfPageOptions'=>array(...// default PDF page options here// could also be an empty array to disable all defaults... ), ), ); }

Custom page options

You can supply custom wkhtmltopdf page options along as third parameter to
renderPdf(). The format is the same as for addPage() in PHPWkHtmlToPdf.