4.2 KiB
Executable File
4.2 KiB
Executable File
TCPDF Methods
All the TCPDF methods can be used, by using the pdf property:
$html2pdf->pdf->...
Display Mode
You can change how your PDF document will be displayed, with the SetDisplayMode method:
$html2pdf = new \Spipu\Html2Pdf\Html2Pdf('P', 'A4', 'en');
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->writeHTML($htmlContent);
$html2pdf->output();
The parameters are:
| Parameter | Default | Description |
|---|---|---|
| $zoom | The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
|
|
| $layout | SinglePage | The page layout. Possible values are:
|
| $mode | UseNone | A name object specifying how the document should be displayed when opened:
|
Document Information
You can change the document information, with the following methods:
$html2pdf = new \Spipu\Html2Pdf\Html2Pdf('P', 'A4', 'en');
$html2pdf->pdf->SetAuthor('LAST-NAME Frist-Name');
$html2pdf->pdf->SetTitle('My Pdf Document');
$html2pdf->pdf->SetSubject('it will be about something important');
$html2pdf->pdf->SetKeywords('example, keywords, others');
$html2pdf->writeHTML($htmlContent);
$html2pdf->output();
Document Protection
You can protect your PDF document, with the setProtection method:
$html2pdf->pdf->SetProtection($permissions, $userPass, $ownerPass, $mode, $pubkeys);
The parameters are:
| Parameter | Default | Description |
|---|---|---|
| $permissions | the set of permissions (specify the ones you want to block):
|
|
| $userPass | user password. Empty by default. | |
| $ownerPass | null | owner password. If not specified, a random value is used. |
| $mode | 0 | encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit. |
| $pubkeys | null | array of recipients containing public-key certificates ('c') and permissions ('p'). For example: array(array('c' => 'file://../examples/data/cert/tcpdf.crt', 'p' => array('print'))) |