Mam problem z Zend_Pdf multilinii, moim problemem jest to, że nie można napisać cały tekst do mojego tekstu pdf.My wygląda następująco: http://pastebin.com/f6413f664Problemy Zend Framework PDF multilinii
Ale gdy otwieram mój plik .pdf, tekst wygląda następująco: http://screencast.com/t/1CBjvRodeZQd
i tu jest mój kod:
public function pdfAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$theID = ($this->_getParam('id') !== NULL) ? (int)$this->_getParam('id') : false;
($theID === false) ? $this->_redirect('/home') : false;
//Information
$info = $this->artists->artistInfo($theID);
// Create new PDF
$pdf = new Zend_Pdf();
$pdf->properties['Title'] = "TITLE";
$pdf->properties['Author'] = "AUTHOR";
// Add new page to the document
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;
// Set font
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
// Draw text
foreach (explode("</p>", $info[0]['biography']) as $i => $line) {
$page->drawText($line, 0, 820 - $i * 10, 'UTF-8');
}
$this->getResponse()->setHeader('Content-type', 'application/x-pdf', true);
$this->getResponse()->setHeader('Content-disposition', 'attachment; filename=my-file.pdf', true);
$this->getResponse()->setBody($pdf->render());
}
Co chcę zrobić, to za każdy <p>
mieć przerwę (<br />
\ n) i do wyświetl cały tekst.
Jakieś rozwiązania facetów?
Tak, to działa, ale mam jeszcze jedno pytanie, jak mogę umieścić na górze przed tekstem, tytułem? – Uffo
zmień 820 w kodzie na ~ 800 i dodaj kolejne wywołanie drawText, aby wydrukować tytuł –
Thx many man !! – Uffo