Source for file class.phpdocpdf.php
Documentation is available at class.phpdocpdf.php
* Cezpdf callback class customized for phpDocumentor
* phpDocumentor :: automatic documentation generator
* Copyright (c) 2000-2006 Joshua Eichorn, Gregory Beaver
* This library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* @copyright 2000-2006 Joshua Eichorn, Gregory Beaver
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version CVS: $Id: class.phpdocpdf.php,v 1.4 2006/04/30 22:18:14 cellog Exp $
* @link http://www.phpdoc.org
* @link http://pear.php.net/PhpDocumentor
include_once 'phpDocumentor/Converters/PDF/default/class.ezpdf.php';
include_once 'phpDocumentor/Converters/PDF/default/ParserPDF.inc';
// define a class extension to allow the use of a callback to get the table of
// contents, and to put the dots in the toc
function phpdocpdf(&$pdfconverter,$fontdir,$paper= 'a4',$orientation= 'portrait')
* This really should be in the parent class
$this->setColor($color['r'], $color['g'], $color['b']);
* Extract Pdfphp-format color from html-format color
function _extractColor($htmlcolor)
preg_match('/#([a-fA-F0-9][a-fA-F0-9])([a-fA-F0-9][a-fA-F0-9])([a-fA-F0-9][a-fA-F0-9])/', $htmlcolor, $color);
return array('r' => $red, 'g' => $green, 'b' => $blue);
return $this->_extractColor($htmlcolor);
$this->setColor($color['r'], $color['g'], $color['b']);
if ($info['status'] == 'start')
$color = $this->_extractColor($info['p']);
// fancy_debug('set color to ',$info['p'],$color, $this->_colorStack);
} elseif ($info['status'] == 'end')
if ($letter == '$') $letter = $name[1];
$this->_ezText($letter,18,array('justification'=> 'left'));
// then we have moved onto a new page, bad bad, as the background colour will be on the old one
// draw a dotted line over to the right and put on a page number
if ($size != 16) $adjust = 1;
$this->line($xpos - (5* $adjust),$info['y'],$info['x']+ 5,$info['y']);
$this->addText($xpos - (5* $adjust)+ 5,$info['y'],$size,$lbl);
* @uses PDFParser extracts all meta-tags and processes text for output
function ezText($text,$size= 0,$options= array(),$test= 0)
function ezOutput($debug = false, $template)
if ($debug) return $this->_save;
$this->ezText($template->fetch('index.tpl'));
function _ezText($text,$size= 0,$options= array(),$test= 0)
return parent::ezText($text,$size,$options,$test);
return $this->y + $offset;
return parent::addMessage($message);
// this function will intially be used to implement underlining support, but could be used for a range of other
$text = str_replace(array('<UL>','</UL>','<LI>','</LI>','<OL>','</OL>','</ol>','<blockquote>','</blockquote>'),
array('<ul>','</ul>','<li>','</li>','<ol>','</ul>','</ul>',"<C:indent:20>\n","<C:indent:-20>"),$text);
// $text = str_replace("<ul>\n","<ul>",$text);
$text = preg_replace("/\n+\s*(<ul>|<ol>)/", "\n\\1", $text);
// some problemos fixed here - hack
$search = array('<ul>','</ul>','<ol>','<li>','</li>');
$replace = array("<C:indent:20>\n","\n<C:indent:-20>","\n<C:indent:20:ordered>\n",'<C:bullet>',"\n");
$text = preg_replace("/([^\n])<C:bullet/", "\\1\n<C:bullet", $text);
$fp = @fopen("C:/Documents and Settings/Owner/Desktop/pdfsourceorig.txt",'a');
$this->ez['leftMargin'] += $margin;
$D = abs($Data["decender"]);
$X = $Data["x"] - ($D * 2) - 10;
$Y = $Data["y"] + ($D * 1.5);
$this->addText($info['x']- 20, $info['y']- 1, 10, $this->listIndex++ . '.');
$parser->parse($template->fetch('pagenumbering.tpl'),$this->font_dir,$this);
|