tFPDF::AddPage PHP Метод

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

public AddPage ( $orientation = '', $size = '' )
    function AddPage($orientation = '', $size = '')
    {
        // Start a new page
        if ($this->state == 0) {
            $this->Open();
        }
        $family = $this->FontFamily;
        $style = $this->FontStyle . ($this->underline ? 'U' : '');
        $fontsize = $this->FontSizePt;
        $lw = $this->LineWidth;
        $dc = $this->DrawColor;
        $fc = $this->FillColor;
        $tc = $this->TextColor;
        $cf = $this->ColorFlag;
        if ($this->page > 0) {
            // Page footer
            $this->InFooter = true;
            $this->Footer();
            $this->InFooter = false;
            // Close page
            $this->_endpage();
        }
        // Start new page
        $this->_beginpage($orientation, $size);
        // Set line cap style to square
        $this->_out('2 J');
        // Set line width
        $this->LineWidth = $lw;
        $this->_out(sprintf('%.2F w', $lw * $this->k));
        // Set font
        if ($family) {
            $this->SetFont($family, $style, $fontsize);
        }
        // Set colors
        $this->DrawColor = $dc;
        if ($dc != '0 G') {
            $this->_out($dc);
        }
        $this->FillColor = $fc;
        if ($fc != '0 g') {
            $this->_out($fc);
        }
        $this->TextColor = $tc;
        $this->ColorFlag = $cf;
        // Page header
        $this->InHeader = true;
        $this->Header();
        $this->InHeader = false;
        // Restore line width
        if ($this->LineWidth != $lw) {
            $this->LineWidth = $lw;
            $this->_out(sprintf('%.2F w', $lw * $this->k));
        }
        // Restore font
        if ($family) {
            $this->SetFont($family, $style, $fontsize);
        }
        // Restore colors
        if ($this->DrawColor != $dc) {
            $this->DrawColor = $dc;
            $this->_out($dc);
        }
        if ($this->FillColor != $fc) {
            $this->FillColor = $fc;
            $this->_out($fc);
        }
        $this->TextColor = $tc;
        $this->ColorFlag = $cf;
    }

Usage Example

Пример #1
1
 function exportarPdf($param)
 {
     /* Abre um arquivo na pasta padrão do projeto, com o nome "resultados.pdf"      */
     $destino = dirname(__FILE__) . "/../../archives/resultados.pdf";
     /* Novo arquivo PDF.                                                            */
     $pdf = new tFPDF('P', 'mm', 'A4');
     /* Nova página em formato de retrato, e define tamanho das tabelas.				*/
     $pdf->AddPage('L');
     $pdf->SetWidths(array(52, 40, 20, 23, 27, 27, 30, 30, 28));
     /* Cabeçalho do PDF, que só vai na primeira página, devidamente formatado.      */
     $pdf->SetFont('Times', 'b', 24);
     $pdf->Cell(40, 10, 'ProDown');
     $pdf->SetTextColor(128, 128, 128);
     $pdf->SetFont('Times', '', 16);
     $pdf->Cell(0, 10, utf8_decode('Sistema de Gestão de Informações'));
     /* Prepara a formatação das tabelas                                             */
     $pdf->SetTextColor(0, 0, 0);
     $pdf->ln();
     $pdf->ln();
     $pdf = $this->geraCabecalho($pdf);
     /* Coloca os resultados obtidos relacionados aos quintis.                       */
     if (is_array($param)) {
         $i = 0;
         foreach ($param as $teste) {
             $pdf->Row(array(utf8_decode($teste['nome']), utf8_decode($teste['turma']), $teste['dt_ocorrencia'], $teste['abdominal'], $teste['agilidade'], $teste['flexibilidade'], $teste['forca_explosiva_inferir'], $teste['forca_explosiva_superior'], $teste['velocidade']));
         }
     }
     /* Quebra de linha com inserção da data e hora em que o PDF foi gerado         */
     $pdf->ln();
     $pdf->Cell(0, 10, utf8_decode(date("d/m/Y - H:i:s")));
     /* Retorna o PDF pra controller, e ela que se vire.                            */
     $pdf->output($destino);
     return ARQUIVO . "resultados.pdf";
 }
All Usage Examples Of tFPDF::AddPage