<?php
/**
* @package Cpdf
*/
/**
* Cpdf
*
*
* A PHP class to provide the basic functionality to create a pdf document without
* any requirement for additional modules.
*
* Note that they companion class CezPdf can be used to extend this class and dramatically
* simplify the creation of documents.
*
* IMPORTANT NOTE
* there is no warranty, implied or otherwise with this software.
*
* LICENCE
* This code has been placed in the Public Domain for all to enjoy.
*
* @author Wayne Munro <pdf@ros.co.nz>
* @version 009
* @package Cpdf
* @link http://www.ros.co.nz/pdf
*/
class Cpdf {
/**
* the current number of pdf objects in the document
*/
var $numObj=0;
/**
* this array contains all of the pdf objects, ready for final assembly
*/
var $objects = array();
/**
* the objectId (number within the objects array) of the document catalog
*/
var $catalogId;
/**
* array carrying information about the fonts that the system currently knows about
* used to ensure that a font is not loaded twice, among other things
*/
var $fonts=array();
/**
* a record of the current font
*/
var $currentFont='';
/**
* the current base font
*/
var $currentBaseFont='';
/**
* the number of the current font within the font array
*/
var $currentFontNum=0;
/**
*
*/
var $currentNode;
/**
* object number of the current page
*/
var $currentPage;
/**
* object number of the currently active contents block
*/
var $currentContents;
/**
* number of fonts within the system
*/
var $numFonts=0;
/**
* current colour for fill operations, defaults to inactive value, all three components should be between 0 and 1 inclusive when active
*/
var $currentColour=array('r'=>-1,'g'=>-1,'b'=>-1);
/**
* current colour for stroke operations (lines etc.)
*/
var $currentStrokeColour=array('r'=>-1,'g'=>-1,'b'=>-1);
/**
* current style that lines are drawn in
*/
var $currentLineStyle='';
/**
* an array which is used to save the state of the document, mainly the colours and styles
* it is used to temporarily change to another state, the change back to what it was before
*/
var $stateStack = array();
/**
* number of elements within the state stack
*/
var $nStateStack = 0;
/**
* number of page objects within the document
*/
var $numPages=0;
/**
* object Id storage stack
*/
var $stack=array();
/**
* number of elements within the object Id storage stack
*/
var $nStack=0;
/**
* an array which contains information about the objects which are not firmly attached to pages
* these have been added with the addObject function
*/
var $looseObjects=array();
/**
* array contains infomation about how the loose objects are to be added to the document
*/
var $addLooseObjects=array();
/**
* the objectId of the information object for the document
* this contains authorship, title etc.
*/
var $infoObject=0;
/**
* number of images being tracked within the document
*/
var $numImages=0;
/**
* an array containing options about the document
* it defaults to turning on the compression of the objects
*/
var $options=array('compression'=>1);
/**
* the objectId of the first page of the document
*/
var $firstPageId;
/**
* used to track the last used value of the inter-word spacing, this is so that it is known
* when the spacing is changed.
*/
var $wordSpaceAdjust=0;
/**
* the object Id of the procset object
*/
var $procsetObjectId;
/**
* store the information about the relationship between font families
* this used so that the code knows which font is the bold version of another font, etc.
* the value of this array is initialised in the constuctor function.
*/
var $fontFamilies = array();
/**
* track if the current font is bolded or italicised
*/
var $currentTextState = '';
/**
* messages are stored here during processing, these can be selected afterwards to give some useful debug information
*/
var $messages='';
/**
* the ancryption array for the document encryption is stored here
*/
var $arc4='';
/**
* the object Id of the encryption information
*/
var $arc4_objnum=0;
/**
* the file identifier, used to uniquely identify a pdf document
*/
var $fileIdentifier='';
/**
* a flag to say if a document is to be encrypted or not
*/
var $encrypted=0;
/**
* the ancryption key for the encryption of all the document content (structure is not encrypted)
*/
var $encryptionKey='';
/**
* array which forms a stack to keep track of nested callback functions
*/
var $callback = array();
/**
* the number of callback functions in the callback array
*/
var $nCallback = 0;
/**
* store label->id pairs for named destinations, these will be used to replace internal links
* done this way so that destinations can be defined after the location that links to them
*/
var $destinations = array();
/**
* store the stack for the transaction commands, each item in here is a record of the values of all the
* variables within the class, so that the user can rollback at will (from each 'start' command)
* note that this includes the objects array, so these can be large.
*/
var $checkpoint = '';
/**
* class constructor
* this will start a new document
* @var array array of 4 numbers, defining the bottom left and upper right corner of the page. first two are normally zero.
*/
function Cpdf ($pageSize=array(0,0,612,792)){
$this->newDocument($pageSize);
// also initialize the font families that are known about already
$this->setFontFamily('init');
// $this->fileIdentifier = md5('xxxxxxxx'.time());
}
/**
* Document object methods (internal use only)
*
* There is about one object method for each type of object in the pdf document
* Each function has the same call list ($id,$action,$options).
* $id = the object ID of the object, or what it is to be if it is being created
* $action = a string specifying the action to be performed, though ALL must support:
* 'new' - create the object with the id $id
* 'out' - produce the output for the pdf object
* $options = optional, a string or array containing the various parameters for the object
*
* These, in conjunction with the output function are the ONLY way for output to be produced
* within the pdf 'file'.
*/
/**
*destination object, used to specify the location for the user to jump to, presently on opening
*/
function o_destination($id,$action,$options=''){
if ($action!='new'){
$o =& $this->objects[$id];
}
switch($action){
case 'new':
$this->objects[$id]=array('t'=>'destination','info'=>array());
$tmp = '';
switch ($options['type']){
case 'XYZ':
case 'FitR':
$tmp = ' '.$options['p3'].$tmp;
case 'FitH':
case 'FitV':
case 'FitBH':
case 'FitBV':
$tmp = ' '.$options['p1'].' '.$options['p2'].$tmp;
case 'Fit':
case 'FitB':
$tmp = $options['type'].$tmp;
$this->objects[$id]['info']['string']=$tmp;
$this->objects[$id]['info']['page']=$options['page'];
}
break;
case 'out':
$tmp = $o['info'];
$res="\n".$id." 0 obj\n".'['.$tmp['page'].' 0 R /'.$tmp['string']."]\nendobj\n";
return $res;
break;
}
}
/**
* set the viewer preferences
*/
function o_viewerPreferences($id,$action,$options=''){
if ($action!='new'){
$o =& $this->objects[$id];
}
switch ($action){
case 'new':
$this->objects[$id]=array('t'=>'viewerPreferences','info'=>array());
break;
case 'add':
foreach($options as $k=>$v){
switch ($k){
case 'HideToolbar':
case 'HideMenubar':
case 'HideWindowUI':
case 'FitWindow':
case 'CenterWindow':
case 'NonFullScreenPageMode':
case 'Direction':
$o['info'][$k]=$v;
break;
}
}
break;
case 'out':
$res="\n".$id." 0 obj\n".'<< ';
foreach($o['info'] as $k=>$v){
$res.="\n/".$k.' '.$v;
}
$res.="\n>>\n";
return $res;
break;
}
}
/**
* define the document catalog, the overall controller for the document
*/
function o_catalog($id,$action,$options=''){
没有合适的资源?快使用搜索试试~ 我知道了~
使用phpdoc/phpDocumentor来生成api文档
共1165个文件
tpl:515个
png:173个
php:165个
需积分: 43 23 下载量 95 浏览量
2015-04-27
13:15:56
上传
评论
收藏 2.01MB ZIP 举报
温馨提示
使用phpdoc/phpDocumentor来生成api文档 使用方法见: http://blog.csdn.net/websites/article/details/45308835
资源推荐
资源详情
资源评论
收起资源包目录
使用phpdoc/phpDocumentor来生成api文档 (1165个子文件)
Release-1.2.0 15KB
Release-1.1.0 11KB
Release-1.3.0 10KB
Release-1.0.0 9KB
Release-1.4.0 5KB
Release-0.4.0 3KB
Release-0.3.0 2KB
Release-1.4.0alpha1 4KB
Release-1.4.0alpha2 4KB
Release-1.2.0beta1 8KB
Release-1.2.0beta2 9KB
Release-1.2.0beta3 10KB
Release-1.2.0rc1 12KB
Release-1.1.0rc1 7KB
Release-1.0.0rc1 7KB
Release-1.4.0rc1 5KB
Release-1.2.0rc2 14KB
Release-1.1.0rc2 9KB
Release-1.4.0rc2 5KB
Release-1.2.3.1 18KB
Release-1.2.1 16KB
Release-1.4.1 4KB
Release-0.4.1 4KB
Release-1.3.1 3KB
Release-1.2.2 18KB
Release-1.3.2 5KB
Release-1.4.2 4KB
Release-0.4.2 2KB
Release-1.2.3 18KB
Release-1.4.3 4KB
Release-0.2.4 2KB
Release-0.2.5 2KB
Release-0.2.6 3KB
php_Helvetica-Oblique.afm 130KB
php_Helvetica.afm 130KB
php_Helvetica-BoldOblique.afm 125KB
php_Helvetica-Bold.afm 125KB
php_Times-Italic.afm 121KB
php_Times-Bold.afm 119KB
php_Times-Roman.afm 115KB
php_Times-BoldItalic.afm 115KB
Helvetica-Oblique.afm 73KB
Helvetica.afm 73KB
Helvetica-BoldOblique.afm 68KB
Helvetica-Bold.afm 68KB
php_Courier-Oblique.afm 66KB
php_Courier-BoldOblique.afm 66KB
php_Courier-Bold.afm 66KB
php_Courier.afm 66KB
Times-Italic.afm 65KB
Times-Bold.afm 63KB
Times-Roman.afm 59KB
Times-BoldItalic.afm 58KB
php_ZapfDingbats.afm 55KB
php_Symbol.afm 54KB
Courier-Oblique.afm 15KB
Courier-BoldOblique.afm 15KB
Courier.afm 15KB
Courier-Bold.afm 15KB
Symbol.afm 10KB
ZapfDingbats.afm 9KB
Authors 944B
pear-phpdoc.bat 5KB
phpdoc.bat 4KB
BUGS 370B
ChangeLog 141KB
ChangeLog 248B
Converter.methods.cls 19KB
HTMLframesConverter.cls 19KB
template.vars.cls 18KB
Converter.cls 14KB
PDFParser.cls 6KB
CHMdefaultConverter.cls 1KB
XMLDocBookConverter.cls 990B
PDFdefaultConverter.cls 990B
HTMLSmartyConverter.cls 990B
style.css 7KB
stylesheet.css 6KB
stylesheet.css 6KB
stylesheet.css 6KB
stylesheet.css 6KB
stylesheet.css 6KB
stylesheet.css 6KB
stylesheet.css 5KB
stylesheet.css 5KB
stylesheet.css 5KB
stylesheet.css 5KB
stylesheet.css 5KB
style.css 5KB
style.css 4KB
style.css 3KB
style.css 2KB
stylesheet.css 2KB
tab.webfx.css 2KB
tab.webfx.css 2KB
layout.css 1KB
layout.css 1KB
banner.css 415B
banner.css 410B
banner.css 410B
共 1165 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
云尔Websites
- 粉丝: 457
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功