9
나는이처럼 보이는 문제가 Zend_PDF의 여러으로, 내 문제는 내가 내 pdf.My 텍스트를 전체 텍스트를 쓸 수 있다는 것입니다 있습니다 http://pastebin.com/f6413f664젠드 프레임 워크 PDF의 여러 문제
을하지만 열 때 내 .pdf 파일은 텍스트는 다음과 같습니다 http://screencast.com/t/1CBjvRodeZQd
을 그리고 여기 내 코드입니다 : 모든 <p>
휴식 (n \ <br />
)와에가하는 내가 원하는 무엇
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());
}
이며, 전체 텍스트를 표시하십시오.
모든 솔루션 녀석들? 대신이의
그래도 작동합니다!하지만 한 가지 더 질문이 있습니다. 텍스트 상단에 어떻게 제목을 붙이면됩니까? – Uffo
코드에서 820을 ~ 800으로 변경하고 다른 drawText 호출을 추가하여 제목을 인쇄하십시오 –
Thx 많은 사람 !! – Uffo