PHP code example of fengxue145 / pdf
1. Go to this page and download the library: Download fengxue145/pdf library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fengxue145 / pdf example snippets
= new \fengxue145\pdf\PDF();
$pdf->SetFonts([
'/usr/local/fonts' => [
'frutiger' => [
'R' => 'Frutiger-Normal.ttf',
'I' => 'FrutigerObl-Normal.ttf',
]
]
]);
$pdf->WriteHTML('<span style="font-family: frutiger">Hello World</span>');
$pdf->Output();
php
d extends \Mpdf\Tag\InlineTag
{
public function open($attr, &$ahtml, &$ihtml)
{
$attr += ['STYLE' => ''];
$attr['STYLE'] .= 'color:red;';
parent::open($attr, $ahtml, $ihtml);
}
}
$pdf = new \fengxue145\pdf\PDF();
$pdf->RegisterTag('<red>', '\Red');
$pdf->WriteHTML('<red>Hello World</red>');
$pdf->Output();
php
d extends \Mpdf\Tag\InlineTag
{
public function open($attr, &$ahtml, &$ihtml)
{
$attr += ['STYLE' => ''];
$attr['STYLE'] .= 'color:red;';
parent::open($attr, $ahtml, $ihtml);
}
}
$pdf = new \fengxue145\pdf\PDF();
$pdf->RegisterTag('<red>', '\Red');
$pdf->WriteHTML('<red>Hello World</red>');
$pdf->Output();