Fpdf edited files not displaying in browsers?

488 views Asked by At

i have added some text using fpdf library.The added text is displayed in adobe reader ,but when i open those files using my browser the text is not visible. I can only see those text using my adobe reader program.

$fullPathToFile = $target_path;

class custom_PDF extends FPDI {

    var $_tplIdx;
    var $file;

    function Header() {
    global $cur_path_to_fil2e;      
    if (is_null($this->_tplIdx)) {
        // THIS IS WHERE YOU GET THE NUMBER OF PAGES
        $this->numPages = $this->setSourceFile($this->file);
        $this->_tplIdx = $this->importPage(1);
    }
    $this->useTemplate($this->_tplIdx, 0, 0, 200);
    }

    function Footer() {

    }

    function setFile($param) {
    $this->file = $param;
    }

}

$pdf234 = new custom_PDF();
$pdf234->setFile($fullPathToFile);
$pdf234->AddPage();
$pdf234->SetFont('Arial','B',14);
$pdf234->SetTextColor(0, 0, 0);
$utf8text = $current_user->user_login . "(" . str_ireplace('_', ' ', $current_user->roles[0]) . ")," . get_bloginfo('name') . "," . get_bloginfo('url') . "\n" . date("d M Y,h:i:s a");
$pdf234->Write(5, $utf8text, get_bloginfo('url'));
if ($pdf234->numPages > 1) {
    for ($i = 2; $i <= $pdf234->numPages; $i++) {
    $pdf234->_tplIdx = $pdf234->importPage($i);
    $pdf234->AddPage();
    $pdf234->Write(5, $utf8text, get_bloginfo('url'));
    }
}
$pdf234->Output($line['name'], 'D');
1

There are 1 answers

0
Kavita On

Thank you everyone for the help. I found the answer .I just added a die() in my code and it works great.

$pdf234->Output($line['name'], 'D');
die();