PHP code example of gablem / aftfpdf

1. Go to this page and download the library: Download gablem/aftfpdf 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/ */

    

gablem / aftfpdf example snippets


$pdf->CheckboxField('option1', 20, 140, 5, 5, array('value' => 'A', 'checked' => true));
$pdf->CheckboxField('option1', 20, 150, 5, 5, array('value' => 'B'));
$pdf->CheckboxField('option2', 20, 160, 5, 5, array('checked' => true)); // Independent checkbox

$pdf->TextField('fullname', 'John Doe', 20, 180, 60, 10);
$pdf->TextField('comments', '', 20, 200, 100, 30, array('multiline' => true));
$pdf->TextField('signature', '', 20, 250, 80, 20, array('signature' => true));



$pdf = new aftFPDF();

$pdf->AddFont('DejaVuSans', '', 'DejaVuSans.ttf', true);
$pdf->SetFont('DejaVuSans');

$pdf->AddPage();

// Set an alpha value for the rectangle
$pdf->SetAlpha(0.5);
$pdf->Rect(20, 20, 50, 50, 'F');

// Set an 50% alpha value for the fill, but keep 100% for the stroke
$pdf->SetAlpha(0.5, 1);
$pdf->Rect(40, 40, 50, 50, 'DF');

// Also works with text
$pdf->SetFontSize(64);
$pdf->SetAlpha(0.5);
$pdf->SetTextColor(255, 0, 0);
$pdf->Text(45, 62, "Hello World");

$pdf->SetTextColor(0, 0, 255);
$pdf->Text(46, 63, "Hello World");

$pdf->Output('output.pdf', 'F');