yxcvbnm1234
Goto Top

PDF via PHP generieren

Hallo zusammen

Ich würde gerne PDF generieren aus dem "info.php" File.

Fehlermeldung Server: Fatal error: Class 'info' not found in DB/Formular.php on line 5

Für jegliche Hilfe wäre ich dankbar! ps

<?php
define('FPDF_FONTPATH','font/');  
require('info.php');  

class PDF extends FPDF
{
//Load data
function LoadData($file)
{
    //Read file lines
    $lines=file($file);
    $data=array();
    foreach($lines as $line)
        $data=explode(';',chop($line));  
    return $data;
}

//Colored table
function FancyTable($header,$data)
{
    //Colors, line width and bold font
    $this->SetFillColor(255,0,0);
    $this->SetTextColor(255);
    $this->SetDrawColor(128,0,0);
    $this->SetLineWidth(.3);
    $this->SetFont('','B');  
    //Header
    $w=array(40,35,40,45);
    for($i=0;$i<count($header);$i++)
        $this->Cell($w[$i],7,$header[$i],1,0,'C',1);  
    $this->Ln();
    //Color and font restoration
    $this->SetFillColor(224,235,255);
    $this->SetTextColor(0);
    $this->SetFont('');  
    //Data
    $fill=0;
    foreach($data as $row)
    {
        $this->Cell($w,6,$row,'LR',0,'L',$fill);  
        $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill);  
        $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill);  
        $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill);  
        $this->Ln();
        $fill=!$fill;
    }
    $this->Cell(array_sum($w),0,'','T');  
}
}

$pdf=new PDF();
//Column titles
$header=array('Country','Capital','Area (sq km)','Pop. (thousands)');  
//Data loading
$data=$pdf->LoadData('info.php');  
$pdf->SetFont('Arial','',14);  
$pdf->AddPage();
$pdf->BasicTable($header,$data);
$pdf->AddPage();
$pdf->ImprovedTable($header,$data);
$pdf->AddPage();
$pdf->FancyTable($header,$data);
$pdf->Output();
?>

Content-Key: 168517

Url: https://administrator.de/contentid/168517

Printed on: April 20, 2024 at 00:04 o'clock

Member: DeamonSadi
DeamonSadi Jun 23, 2011 at 10:55:29 (UTC)
Goto Top
Morgen yxcvbnm1234,
heut ist ein Feiertag und deswegen bin ich etwas Faul!!!
^^
Test einfach mal dieses Tutorial!!!
1
Hier ist es ganz schön beschrieben wie man ein pdf mittels php erzeugt!!!
Viel Spaß Damit

Lg

Sadi

Ps.: Das nächste mal erst googlen!!! War der erste Treffer!!!