PHP Класс Pop\Pdf\Pdf

Автор: Nick Sagona, III ([email protected])
Наследование: extends Pop\Pdf\AbstractPdf
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$allowed array Array of allowed file types.
$backgroundColor mixed Background color of the document
$bytelength integer PDF bytelength
$compress boolean Compression property
$curPage integer Current PDF page.
$fillColor mixed Fill color of the document
$fonts array Current fonts added to the PDF
$images string Array of images added to the PDF
$info integer PDF info index.
$lastFontName string Last font name
$objects array Array of PDF objects.
$pages array Array of PDF page object indices.
$parent integer PDF parent index.
$root integer PDF root index.
$standardFonts array Standard PDF fonts with their approximate character width and height factors.
$stroke boolean Stroke ON or OFF flag
$strokeColor mixed Stroke color of the document
$strokeDashGap integer Stroke dash gap
$strokeDashLength integer Stroke dash length
$strokeWidth integer Stroke width
$textParams array PDF text parameters.
$trailer string PDF trailer.

Открытые методы

Метод Описание
__construct ( string $pdf, string $sz = null, integer $w = null, integer $h = null ) : Pdf Constructor
addFont ( string $font, boolean $embedOverride = false ) : Pdf Method to add a font to the PDF.
addImage ( string $image, integer $x, integer $y, mixed $scl = null, boolean $preserveRes = true ) : Pdf Method to add an image to the PDF.
addLink ( integer $x, integer $y, integer $w, integer $h, integer $X, integer $Y, integer $Z, integer $dest = null ) : Pdf Method to add an internal link to the PDF.
addPage ( string $sz = null, integer $w = null, integer $h = null ) : Pdf Method to add a page to the PDF of a determined size.
addText ( integer $x, integer $y, integer $size, string $str, string $font = null ) : Pdf Method to add text to the PDF.
addUrl ( integer $x, integer $y, integer $w, integer $h, string $url ) : Pdf Method to add a URL link to the PDF.
closeLayer ( ) : Pdf Method to close a new graphics state layer within the PDF.
copyPage ( integer $pg ) : Pdf Method to copy a page of the PDF.
curPage ( ) : integer Method to return the current page number of the current page of the PDF.
deletePage ( integer $pg ) : Pdf Method to delete the page of the PDF and its content objects.
drawArc ( integer $x, integer $y, integer $start, integer $end, integer $w, integer $h = null, boolean $fill = true ) : Pdf Method to add an arc to the PDF.
drawCircle ( integer $x, integer $y, integer $w, boolean $fill = true ) : Pdf Method to add a circle to the PDF.
drawClippingCircle ( integer $x, integer $y, integer $w ) : Pdf Method to add a clipping circle to the PDF.
drawClippingEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Pdf Method to add a clipping ellipse to the PDF.
drawClippingPolygon ( array $points ) : Pdf Method to add a clipping polygon to the PDF.
drawClippingRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : Pdf Method to add a clipping rectangle to the PDF.
drawClippingSquare ( integer $x, integer $y, integer $w ) : Pdf Method to add a clipping square to the PDF.
drawEllipse ( integer $x, integer $y, integer $w, integer $h = null, boolean $fill = true ) : Pdf Method to add an ellipse to the PDF.
drawLine ( integer $x1, integer $y1, integer $x2, integer $y2 ) : Pdf Method to add a line to the PDF.
drawPolygon ( array $points, boolean $fill = true ) : Pdf Method to add a polygon to the image.
drawRectangle ( integer $x, integer $y, integer $w, integer $h = null, boolean $fill = true ) : Pdf Method to add a rectangle to the PDF.
drawSquare ( integer $x, integer $y, integer $w, boolean $fill = true ) : Pdf Method to add a square to the PDF.
finalize ( ) : Pdf Method to finalize the PDF.
getCompression ( ) : boolean Method to get the compression of the PDF.
getFonts ( ) : string Method to return the name of the last font added.
getLastFontName ( ) : string Method to return the name of the last font added.
getStringSize ( string $str, string $font, integer $sz ) : array Method to get the width and height of a string in a certain font. It returns an array with the approximate width, height and offset baseline values.
import ( string $pdf, integer | string | array $pg = null ) : Pdf Method to import either an entire PDF, or a page of a PDF, and the related data.
numPages ( ) : integer Method to return the current number of pages in the PDF.
openLayer ( ) : Pdf Method to open a new graphics state layer within the PDF.
orderPages ( array $pgs ) : Pdf Method to order the pages of the PDF.
output ( boolean $download = false ) : void Output the PDF directly to the browser.
save ( string $to = null, boolean $append = false ) : Pdf Save the PDF directly to the server.
setAuthor ( string $auth ) : Pdf Method to set the PDF info author.
setBackgroundColor ( Pop\Color\Space\ColorInterface $color ) : Pdf Method to set the background of the document.
setCompression ( boolean $comp = false ) : Pdf Method to set the compression of the PDF.
setCreateDate ( string $dt ) : Pdf Method to set the PDF info creation date.
setFillColor ( Pop\Color\Space\ColorInterface $color ) : Pdf Method to set the fill color of objects and text in the PDF.
setModDate ( string $dt ) : Pdf Method to set the PDF info modification date.
setPage ( integer $pg ) : Pdf Method to set the current page of the PDF in which to edit.
setStrokeColor ( Pop\Color\Space\ColorInterface $color ) : Pdf Method to set the stroke color of paths in the PDF.
setStrokeWidth ( integer $w = null, integer $dash_len = null, integer $dash_gap = null ) : Pdf Method to set the width and dash properties of paths in the PDF.
setSubject ( string $subj ) : Pdf Method to set the PDF info subject.
setTextParams ( integer $c, integer $w, integer $h = 100, integer $v = 100, integer $rot, integer $rend ) : Pdf Method to set the text parameters for rendering text content.
setTitle ( string $tle ) : Pdf Method to set the PDF info title.
setVersion ( string $ver ) : Pdf Method to set the PDF version.

Защищенные методы

Метод Описание
calcByteLength ( string $str ) : integer Method to calculate byte length.
calcTextMatrix ( ) : string Method to calculate text matrix.
convertColor ( integer | string $color ) : float Method to convert color.
formatByteLength ( integer | string $num ) : string Method to format byte length.
getContentObject ( ) : integer Method to return the current page's content object, or create one if necessary.
getQuadrant ( array $point, array $center ) : integer Method to calculate which quadrant a point is in.
lastIndex ( array $arr ) : integer Method to return the last object index.
setStyle ( boolean $fill ) : string Method to set the fill/stroke style.

Описание методов

__construct() публичный Метод

Instantiate a PDF file object based on either a pre-existing PDF file on disk, or a new PDF file. Arguments may be passed to add a page upon instantiation. The PDF file exists, it and all of its assets will be imported.
public __construct ( string $pdf, string $sz = null, integer $w = null, integer $h = null ) : Pdf
$pdf string
$sz string
$w integer
$h integer
Результат Pdf

addFont() публичный Метод

Method to add a font to the PDF.
public addFont ( string $font, boolean $embedOverride = false ) : Pdf
$font string
$embedOverride boolean
Результат Pdf

addImage() публичный Метод

Method to add an image to the PDF.
public addImage ( string $image, integer $x, integer $y, mixed $scl = null, boolean $preserveRes = true ) : Pdf
$image string
$x integer
$y integer
$scl mixed
$preserveRes boolean
Результат Pdf

addPage() публичный Метод

Method to add a page to the PDF of a determined size.
public addPage ( string $sz = null, integer $w = null, integer $h = null ) : Pdf
$sz string
$w integer
$h integer
Результат Pdf

addText() публичный Метод

Method to add text to the PDF.
public addText ( integer $x, integer $y, integer $size, string $str, string $font = null ) : Pdf
$x integer
$y integer
$size integer
$str string
$font string
Результат Pdf

addUrl() публичный Метод

Method to add a URL link to the PDF.
public addUrl ( integer $x, integer $y, integer $w, integer $h, string $url ) : Pdf
$x integer
$y integer
$w integer
$h integer
$url string
Результат Pdf

calcByteLength() защищенный Метод

Method to calculate byte length.
protected calcByteLength ( string $str ) : integer
$str string
Результат integer

calcTextMatrix() защищенный Метод

Method to calculate text matrix.
protected calcTextMatrix ( ) : string
Результат string

closeLayer() публичный Метод

Must be used in conjunction with the openLayer() method.
public closeLayer ( ) : Pdf
Результат Pdf

convertColor() защищенный Метод

Method to convert color.
protected convertColor ( integer | string $color ) : float
$color integer | string
Результат float

copyPage() публичный Метод

Method to copy a page of the PDF.
public copyPage ( integer $pg ) : Pdf
$pg integer
Результат Pdf

curPage() публичный Метод

Method to return the current page number of the current page of the PDF.
public curPage ( ) : integer
Результат integer

deletePage() публичный Метод

Method to delete the page of the PDF and its content objects.
public deletePage ( integer $pg ) : Pdf
$pg integer
Результат Pdf

drawArc() публичный Метод

Method to add an arc to the PDF.
public drawArc ( integer $x, integer $y, integer $start, integer $end, integer $w, integer $h = null, boolean $fill = true ) : Pdf
$x integer
$y integer
$start integer
$end integer
$w integer
$h integer
$fill boolean
Результат Pdf

drawCircle() публичный Метод

Method to add a circle to the PDF.
public drawCircle ( integer $x, integer $y, integer $w, boolean $fill = true ) : Pdf
$x integer
$y integer
$w integer
$fill boolean
Результат Pdf

drawClippingCircle() публичный Метод

Method to add a clipping circle to the PDF.
public drawClippingCircle ( integer $x, integer $y, integer $w ) : Pdf
$x integer
$y integer
$w integer
Результат Pdf

drawClippingEllipse() публичный Метод

Method to add a clipping ellipse to the PDF.
public drawClippingEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Pdf
$x integer
$y integer
$w integer
$h integer
Результат Pdf

drawClippingPolygon() публичный Метод

Method to add a clipping polygon to the PDF.
public drawClippingPolygon ( array $points ) : Pdf
$points array
Результат Pdf

drawClippingRectangle() публичный Метод

Method to add a clipping rectangle to the PDF.
public drawClippingRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : Pdf
$x integer
$y integer
$w integer
$h integer
Результат Pdf

drawClippingSquare() публичный Метод

Method to add a clipping square to the PDF.
public drawClippingSquare ( integer $x, integer $y, integer $w ) : Pdf
$x integer
$y integer
$w integer
Результат Pdf

drawEllipse() публичный Метод

Method to add an ellipse to the PDF.
public drawEllipse ( integer $x, integer $y, integer $w, integer $h = null, boolean $fill = true ) : Pdf
$x integer
$y integer
$w integer
$h integer
$fill boolean
Результат Pdf

drawLine() публичный Метод

Method to add a line to the PDF.
public drawLine ( integer $x1, integer $y1, integer $x2, integer $y2 ) : Pdf
$x1 integer
$y1 integer
$x2 integer
$y2 integer
Результат Pdf

drawPolygon() публичный Метод

Method to add a polygon to the image.
public drawPolygon ( array $points, boolean $fill = true ) : Pdf
$points array
$fill boolean
Результат Pdf

drawRectangle() публичный Метод

Method to add a rectangle to the PDF.
public drawRectangle ( integer $x, integer $y, integer $w, integer $h = null, boolean $fill = true ) : Pdf
$x integer
$y integer
$w integer
$h integer
$fill boolean
Результат Pdf

drawSquare() публичный Метод

Method to add a square to the PDF.
public drawSquare ( integer $x, integer $y, integer $w, boolean $fill = true ) : Pdf
$x integer
$y integer
$w integer
$fill boolean
Результат Pdf

finalize() публичный Метод

Method to finalize the PDF.
public finalize ( ) : Pdf
Результат Pdf

formatByteLength() защищенный Метод

Method to format byte length.
protected formatByteLength ( integer | string $num ) : string
$num integer | string
Результат string

getCompression() публичный Метод

Method to get the compression of the PDF.
public getCompression ( ) : boolean
Результат boolean

getContentObject() защищенный Метод

Method to return the current page's content object, or create one if necessary.
protected getContentObject ( ) : integer
Результат integer

getFonts() публичный Метод

Method to return the name of the last font added.
public getFonts ( ) : string
Результат string

getLastFontName() публичный Метод

Method to return the name of the last font added.
public getLastFontName ( ) : string
Результат string

getQuadrant() защищенный Метод

Method to calculate which quadrant a point is in.
protected getQuadrant ( array $point, array $center ) : integer
$point array
$center array
Результат integer

getStringSize() публичный Метод

Method to get the width and height of a string in a certain font. It returns an array with the approximate width, height and offset baseline values.
public getStringSize ( string $str, string $font, integer $sz ) : array
$str string
$font string
$sz integer
Результат array

import() публичный Метод

Method to import either an entire PDF, or a page of a PDF, and the related data.
public import ( string $pdf, integer | string | array $pg = null ) : Pdf
$pdf string
$pg integer | string | array
Результат Pdf

lastIndex() защищенный Метод

Method to return the last object index.
protected lastIndex ( array $arr ) : integer
$arr array
Результат integer

numPages() публичный Метод

Method to return the current number of pages in the PDF.
public numPages ( ) : integer
Результат integer

openLayer() публичный Метод

Must be used in conjunction with the closeLayer() method.
public openLayer ( ) : Pdf
Результат Pdf

orderPages() публичный Метод

Method to order the pages of the PDF.
public orderPages ( array $pgs ) : Pdf
$pgs array
Результат Pdf

output() публичный Метод

Output the PDF directly to the browser.
public output ( boolean $download = false ) : void
$download boolean
Результат void

save() публичный Метод

Save the PDF directly to the server.
public save ( string $to = null, boolean $append = false ) : Pdf
$to string
$append boolean
Результат Pdf

setAuthor() публичный Метод

Method to set the PDF info author.
public setAuthor ( string $auth ) : Pdf
$auth string
Результат Pdf

setBackgroundColor() публичный Метод

Method to set the background of the document.
public setBackgroundColor ( Pop\Color\Space\ColorInterface $color ) : Pdf
$color Pop\Color\Space\ColorInterface
Результат Pdf

setCompression() публичный Метод

Method to set the compression of the PDF.
public setCompression ( boolean $comp = false ) : Pdf
$comp boolean
Результат Pdf

setCreateDate() публичный Метод

Method to set the PDF info creation date.
public setCreateDate ( string $dt ) : Pdf
$dt string
Результат Pdf

setFillColor() публичный Метод

Method to set the fill color of objects and text in the PDF.
public setFillColor ( Pop\Color\Space\ColorInterface $color ) : Pdf
$color Pop\Color\Space\ColorInterface
Результат Pdf

setModDate() публичный Метод

Method to set the PDF info modification date.
public setModDate ( string $dt ) : Pdf
$dt string
Результат Pdf

setPage() публичный Метод

Method to set the current page of the PDF in which to edit.
public setPage ( integer $pg ) : Pdf
$pg integer
Результат Pdf

setStrokeColor() публичный Метод

Method to set the stroke color of paths in the PDF.
public setStrokeColor ( Pop\Color\Space\ColorInterface $color ) : Pdf
$color Pop\Color\Space\ColorInterface
Результат Pdf

setStrokeWidth() публичный Метод

Method to set the width and dash properties of paths in the PDF.
public setStrokeWidth ( integer $w = null, integer $dash_len = null, integer $dash_gap = null ) : Pdf
$w integer
$dash_len integer
$dash_gap integer
Результат Pdf

setStyle() защищенный Метод

Method to set the fill/stroke style.
protected setStyle ( boolean $fill ) : string
$fill boolean
Результат string

setSubject() публичный Метод

Method to set the PDF info subject.
public setSubject ( string $subj ) : Pdf
$subj string
Результат Pdf

setTextParams() публичный Метод

Method to set the text parameters for rendering text content.
public setTextParams ( integer $c, integer $w, integer $h = 100, integer $v = 100, integer $rot, integer $rend ) : Pdf
$c integer (character spacing)
$w integer (word spacing)
$h integer (horz stretch)
$v integer (vert stretch)
$rot integer (rotation)
$rend integer (render flag, 0 - 7)
Результат Pdf

setTitle() публичный Метод

Method to set the PDF info title.
public setTitle ( string $tle ) : Pdf
$tle string
Результат Pdf

setVersion() публичный Метод

Method to set the PDF version.
public setVersion ( string $ver ) : Pdf
$ver string
Результат Pdf

Описание свойств

$allowed защищенное свойство

Array of allowed file types.
protected array $allowed
Результат array

$backgroundColor защищенное свойство

Background color of the document
protected mixed $backgroundColor
Результат mixed

$bytelength защищенное свойство

PDF bytelength
protected int $bytelength
Результат integer

$compress защищенное свойство

Compression property
protected bool $compress
Результат boolean

$curPage защищенное свойство

Current PDF page.
protected int $curPage
Результат integer

$fillColor защищенное свойство

Fill color of the document
protected mixed $fillColor
Результат mixed

$fonts защищенное свойство

Current fonts added to the PDF
protected array $fonts
Результат array

$images защищенное свойство

Array of images added to the PDF
protected string $images
Результат string

$info защищенное свойство

PDF info index.
protected int $info
Результат integer

$lastFontName защищенное свойство

Last font name
protected string $lastFontName
Результат string

$objects защищенное свойство

Array of PDF objects.
protected array $objects
Результат array

$pages защищенное свойство

Array of PDF page object indices.
protected array $pages
Результат array

$parent защищенное свойство

PDF parent index.
protected int $parent
Результат integer

$root защищенное свойство

PDF root index.
protected int $root
Результат integer

$standardFonts защищенное свойство

Standard PDF fonts with their approximate character width and height factors.
protected array $standardFonts
Результат array

$stroke защищенное свойство

Stroke ON or OFF flag
protected bool $stroke
Результат boolean

$strokeColor защищенное свойство

Stroke color of the document
protected mixed $strokeColor
Результат mixed

$strokeDashGap защищенное свойство

Stroke dash gap
protected int $strokeDashGap
Результат integer

$strokeDashLength защищенное свойство

Stroke dash length
protected int $strokeDashLength
Результат integer

$strokeWidth защищенное свойство

Stroke width
protected int $strokeWidth
Результат integer

$textParams защищенное свойство

PDF text parameters.
protected array $textParams
Результат array

$trailer защищенное свойство

PDF trailer.
protected string $trailer
Результат string