Отредактированные Fpdf файлы не отображаются в браузерах?

0

Я добавил текст с помощью библиотеки fpdf. Добавленный текст отображается в Adobe Reader, но когда я открываю эти файлы с помощью моего браузера, текст не отображается. Я могу видеть только этот текст, используя мою программу чтения Adobe.

$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');
  • 0
    Вы используете последний файл fpdf_tpl.php
  • 0
    FPDI - версия 1.5.2
Показать ещё 1 комментарий
Теги:
pdf
pdf-generation
fpdi

1 ответ

0

Спасибо всем за помощь. Я нашел ответ. Я только что добавил die() в свой код, и он отлично работает.

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

Ещё вопросы

Сообщество Overcoder
Наверх
Меню