- Código: Selecionar tudo
<?php
require_once 'Zend/Pdf.php';
class pdfController extends Zend_Controller_Action {
public function indexAction() {
$pdf = new Zend_Pdf();
$pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4); //adiona a pagina ao documento
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
// Aplica fonte
$pdfPage->setFont($font, 36);
$pdfPage->drawText("hello world",72,720,'UTF-8');
$pdf->pages[0]= $pdfPage;
$pdf->save("garantia.pdf");
header('Content-type: application/pdf');
echo $pdf->render();
}
}
esse é o que aparece no navegador
- Código: Selecionar tudo
%PDF-1.4 %���� 1 0 obj <> endobj 2 0 obj <> endobj 3 0 obj <> >> /MediaBox [0 0 595 842 ] /Contents [4 0 R ] /Parent 2 0 R >> endobj 4 0 obj <> stream /F1 36 Tf BT 72 720 Td (hello world) Tj ET endstream endobj 5 0 obj [] endobj 6 0 obj <> endobj 7 0 obj <> endobj 8 0 obj <> endobj xref 0 9 0000000000 65535 f 0000000015 00000 n 0000000091 00000 n 0000000149 00000 n 0000000336 00000 n 0000000429 00000 n 0000000448 00000 n 0000000482 00000 n 0000000516 00000 n trailer < <66666435383633346362323930393632> ] /Size 9 /Root 1 0 R >> startxref 611 %%EOF
alguem pode me ajudar a exibir o pdf no navegador.
abraços



