Wiki source for ZendPDF


Show raw source

===Zend PDF Library===

== howto use zend php pdf library to write a pdf (using a 'standard' pdf font)==
%%(php)
// ++ setup and configure Zend 1.8 & 2.0
set_include_path('/yourpath/yourzend/' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader/AutoLoader.php';
Zend_Loader_Autoloader::getInstance();
// -- setup and configure Zend 1.8 & 2.0

$pdf = new Zend_Pdf();

$pdf->pages[] = ($page1 = $pdf->newPage('A4'));
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
$page1->setFont($font, 20);
$page1->drawText('ZEND', 40, 700, 'UTF-8');
$page1->drawText('PDF', 40, 800, 'UTF-8');

$pdf->save('pdf.pdf');
%%

== howto use zend php pdf library to embed a font into a pdf==
You need to get and download a free libre open source font sucha as 'Liberation' first
%%
set_include_path('library' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader/AutoLoader.php';
Zend_Loader_Autoloader::getInstance();

$pdf = new Zend_Pdf();

$pdf->pages[] = ($page1 = $pdf->newPage('A4'));
$font = Zend_Pdf_Font::fontWithPath('ttf/LiberationSans-Regular.ttf');
$page1->setFont($font, 20);
$page1->drawText('ZEND', 40, 700, 'UTF-8');
$page1->drawText('PDF', 40, 800, 'UTF-8');
$pdf->save("pdf.pdf");
%%

----
REFERRERS
{{backlinks}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki