PDFLib

From: Date: Sun, 09 Jul 2000 18:03:48 +0000
Subject: PDFLib
Groups: php.general 
Request: Send a blank email to php-general+get-5619@lists.php.net to get a copy of this message
Hi Terry, this is a little recipe to get working PDFlib with PHP4: 1 - download PHP directly from http://cvs.php.net Uwe Steinman patched ext/pdf/pdf.c to support PDFLib v 3.0.1 2 - download PDFLib 3.0.1 from http://www.pdflib.com 2.a - apply every patch you find http://www.pdflib.com/pdflib/patches.html 2.b - Configure, Make & install PDFLib ./configure --enabled-shared-pdflib make make install 3 - Configure PHP ./configure --with-apxs=/usr/bin/apxs \ --with-gd --with-pdflib=/usr/local --with-mysql=/usr/local --with-pgsql=/usr --with-dbase \ --with-config-file-path=/etc/httpd --with-zlib-dir=/usr --with-ttf=/usr/local/include \ --with-jpeg-dir=/usr --with-tiff-dir=/usr --with-system-regex=yes --enable-debug=no make make install 4 - Test & Hack Now you need to restart Apache apachectl restart Copy pdfclock.php in your httpd directory... test... and That's all. Ciao Luca -- ________________________________________________________________ Ing. Luca Perugini o Linux Consultant Editor PHP Manual Italian language o mailto:perugini@php.net SysAdmin o http://www.uisp.it SysAdmin o http://www.sporty.it ________________________________________________________________

<? header("Content-type: application/pdf"); header( "Content-Disposition: attachment; filename=pdfclock.pdf" ); header( "Content-Description: PHP3 Generated Data" ); $RADIUS = 200.0; $MARGIN = 20.0; $p = PDF_open(); //PDF_open_file($p, "pdfclock_pl.pdf"); PDF_set_info($p, "Creator", "pdfclock.pl"); PDF_set_info($p, "Author", "Thomas Merz"); PDF_set_info($p, "Title", "PDF clock (Perl)"); PDF_begin_page($p, 2 * ($RADIUS + $MARGIN), 2 * ($RADIUS + $MARGIN)); PDF_translate($p, $RADIUS + $MARGIN, $RADIUS + $MARGIN); PDF_setrgbcolor($p, 0.0, 0.0, 1.0); PDF_save($p); # minute strokes PDF_setlinewidth($p, 2.0); for ($alpha = 0; $alpha < 360; $alpha += 6) { PDF_rotate($p, 6.0); PDF_moveto($p, $RADIUS, 0.0); PDF_lineto($p, $RADIUS-$MARGIN/3, 0.0); PDF_stroke($p); } PDF_restore($p); PDF_save($p); # 5 minute strokes PDF_setlinewidth($p, 3.0); for ($alpha = 0; $alpha < 360; $alpha += 30) { PDF_rotate($p, 30.0); PDF_moveto($p, $RADIUS, 0.0); PDF_lineto($p, $RADIUS-$MARGIN, 0.0); PDF_stroke($p); } $tm_sec=20; $tm_min=15; $tm_hour=7; # draw hour hand PDF_save($p); PDF_rotate($p, (-(($tm_min/60.0) + $tm_hour - 3.0) * 30.0)); PDF_moveto($p, -$RADIUS/10, -$RADIUS/20); PDF_lineto($p, $RADIUS/2, 0.0); PDF_lineto($p, -$RADIUS/10, $RADIUS/20); PDF_closepath($p); PDF_fill($p); PDF_restore($p); # draw minute hand PDF_save($p); PDF_rotate($p, (-(($tm_sec/60.0) + $tm_min - 15.0) * 6.0)); PDF_moveto($p, -$RADIUS/10, -$RADIUS/20); PDF_lineto($p, $RADIUS * 0.8, 0.0); PDF_lineto($p, -$RADIUS/10, $RADIUS/20); PDF_closepath($p); PDF_fill($p); PDF_restore($p); # draw second hand PDF_setrgbcolor($p, 1.0, 0.0, 0.0); PDF_setlinewidth($p, 2); PDF_save($p); PDF_rotate($p, -(($tm_sec - 15.0) * 6.0)); PDF_moveto($p, -$RADIUS/5, 0.0); PDF_lineto($p, $RADIUS, 0.0); PDF_stroke($p); PDF_restore($p); # draw little circle at center PDF_circle($p, 0, 0, $RADIUS/30); PDF_fill($p); PDF_restore($p); PDF_end_page($p); PDF_close($p); //PDF_delete($p); ?>
« previous php.general (#5619) next »