class Styles extends AbstractWriter

Methods

void
beginStyles()

Begin buffering output to capture the styles

void
endStyles()

Import our styles to the PDF generator.

Details

at line 57
void beginStyles()

Begin buffering output to capture the styles

Example

See $this->endStyles() below.

Return Value

void

at line 92
void endStyles()

Import our styles to the PDF generator.

This method takes the captured buffer (which started when $w->beginStyles() was called), strips the style HTML tags (we include them for syntax sugar in our IDEs) and adds it to Mpdf.

Refer to Mpdf's documentation to see what classes as valid CSS http://mpdf.github.io/css-stylesheets/supported-css.html

Example

 // Load our custom CSS styles that'll apply to the PDF template
 $w->beginStyles();
 ?>
 <style>
     body {
         color: #999;
     }

     // Add styles to content added via `$w->add()`
     .single {
         background: #999;
         color: #FFF;
     }
 </style>
 <?php
 $w->endStyles();

Return Value

void