tFPDF::SetMargins PHP Метод

SetMargins() публичный Метод

public SetMargins ( $left, $top, $right = null )
    function SetMargins($left, $top, $right = null)
    {
        // Set left, top and right margins
        $this->lMargin = $left;
        $this->tMargin = $top;
        if ($right === null) {
            $right = $left;
        }
        $this->rMargin = $right;
    }

Usage Example

Пример #1
0
 /**
  * Creates content that should be printed
  *
  * @param Collection $collection
  * @return string
  */
 public function renderCollectionContent($collection)
 {
     $pdf = new \tFPDF('P', 'mm', [72, 80]);
     $pdf->SetMargins(0, 2);
     // Запретим автоматический разрыв страниц
     $pdf->SetAutoPageBreak(false, 0);
     $pdf->AddPage();
     $pdf->AddFont('arial', '', 'arial.ttf', true);
     $pdf->AddFont('arialbd', '', 'arialbd.ttf', true);
     $this->makeLine($pdf, Settings::get()->terminalName(), 10, 5)->makeLine($pdf, date('H:i:s d.m.Y', time()), 10, 5)->makeLine($pdf, $collection->sum . ' руб.', 16, 15, true)->makeLine($pdf, 'Инкассация:', 10, 10)->makeLine($pdf, (string) $collection->id, 12, 5)->makeLine($pdf, Settings::get()->contactInfo(), 8, 15)->makeLine($pdf, 'Сохраняйте чек', 8, 4);
     $fileName = __DIR__ . '/../runtime/pdf/collection_ticket.pdf';
     $pdf->Output($fileName, 'F');
     return $fileName;
 }
All Usage Examples Of tFPDF::SetMargins