Parser
in package
Pdf HTML parser class
Tags
Table of Contents
- $css : Css
- CSS object
- $defaultStyles : array<string|int, mixed>
- Default styles
- $document : Document
- PDF document
- $fileDir : string
- HTML file directory
- $html : Child|array<string|int, mixed>
- HTML object or array of HTML objects
- $page : Page
- Current page object
- $pageMargins : array<string|int, mixed>
- Page margins
- $pageSize : string
- Page size
- $textWrap : Wrap
- Text wrap object
- $x : int
- Current x-position
- $y : int
- Current y-position
- $yOverride : int
- Y-override
- __construct() : mixed
- Constructor
- document() : Document
- Get document (alias)
- getCss() : Css
- Get styles
- getDefaultStyle() : string
- Get a default style
- getDefaultStyles() : array<string|int, mixed>
- Get default styles
- getDocument() : Document
- Get document
- getHtml() : Child|array<string|int, mixed>
- Get HTML nodes
- getPageBottomMargin() : int
- Get page bottom margin
- getPageLeftMargin() : int
- Get page left margin
- getPageMargins() : array<string|int, mixed>
- Get page margins
- getPageRightMargin() : int
- Get page right margin
- getPageSize() : string|array<string|int, mixed>
- Get page size
- getPageTopMargin() : int
- Get page top margin
- getX() : int
- Get x-position
- getY() : int
- Get y-position
- parseCss() : self
- Parse CSS string
- parseCssFile() : self
- Parse CSS file
- parseCssUri() : self
- Parse CSS URI
- parseFile() : self
- Parse $html from file
- parseHtml() : self
- Parse HTML string
- parseHtmlFile() : self
- Parse HTML string from file
- parseHtmlUri() : self
- Parse HTML string from URI
- parseString() : self
- Parse HTML string
- parseUri() : self
- Parse $html from URI
- prepare() : array<string|int, mixed>|Child
- Prepare for conversion of HTML into PDF objects
- process() : Document
- Process conversion of HTML into PDF objects
- setDefaultStyle() : self
- Set a default style
- setDocument() : self
- Set document
- setPageBottomMargin() : self
- Set page bottom margin
- setPageLeftMargin() : self
- Set page left margin
- setPageMargins() : self
- Set page margins
- setPageRightMargin() : self
- Set page right margin
- setPageSize() : self
- Set page size
- setPageTopMargin() : self
- Set page top margin
- setX() : self
- Set x-position
- setY() : self
- Set y-position
- addNodeStreamToDocument() : void
- Add node stream to document
- addNodeToDocument() : void
- Add node to document
- createDefaultStyles() : void
- Create default styles
- getCurrentX() : int
- Get current X-position
- getCurrentY() : int
- Get current Y-position
- getStringLines() : array<string|int, mixed>
- Get string lines
- goToNextLine() : void
- Go to next line
- newPage() : int
- Create new page
- prepareNodeStyles() : array<string|int, mixed>
- Prepare node styles
- resetX() : int
- Reset X-position
- resetY() : int
- Reset Y-position
Properties
$css
CSS object
protected
Css
$css
= null
$defaultStyles
Default styles
protected
array<string|int, mixed>
$defaultStyles
= ['font-family' => 'Arial', 'font-size' => 10, 'font-weight' => 'normal', 'color' => [0, 0, 0], 'line-height' => 14]
$document
PDF document
protected
Document
$document
= null
$fileDir
HTML file directory
protected
string
$fileDir
= null
$html
HTML object or array of HTML objects
protected
Child|array<string|int, mixed>
$html
= null
$page
Current page object
protected
Page
$page
= null
$pageMargins
Page margins
protected
array<string|int, mixed>
$pageMargins
= ['top' => 80, 'right' => 60, 'bottom' => 60, 'left' => 60]
$pageSize
Page size
protected
string
$pageSize
= 'LETTER'
$textWrap
Text wrap object
protected
Wrap
$textWrap
= null
$x
Current x-position
protected
int
$x
= 0
$y
Current y-position
protected
int
$y
= 0
$yOverride
Y-override
protected
int
$yOverride
= null
Methods
__construct()
Constructor
public
__construct([Document $document = null ]) : mixed
Instantiate the HTML parser object
Parameters
- $document : Document = null
Return values
mixed —document()
Get document (alias)
public
document() : Document
Return values
Document —getCss()
Get styles
public
getCss() : Css
Return values
Css —getDefaultStyle()
Get a default style
public
getDefaultStyle(string $property) : string
Parameters
- $property : string
Return values
string —getDefaultStyles()
Get default styles
public
getDefaultStyles() : array<string|int, mixed>
Return values
array<string|int, mixed> —getDocument()
Get document
public
getDocument() : Document
Return values
Document —getHtml()
Get HTML nodes
public
getHtml() : Child|array<string|int, mixed>
Return values
Child|array<string|int, mixed> —getPageBottomMargin()
Get page bottom margin
public
getPageBottomMargin() : int
Return values
int —getPageLeftMargin()
Get page left margin
public
getPageLeftMargin() : int
Return values
int —getPageMargins()
Get page margins
public
getPageMargins() : array<string|int, mixed>
Return values
array<string|int, mixed> —getPageRightMargin()
Get page right margin
public
getPageRightMargin() : int
Return values
int —getPageSize()
Get page size
public
getPageSize() : string|array<string|int, mixed>
Return values
string|array<string|int, mixed> —getPageTopMargin()
Get page top margin
public
getPageTopMargin() : int
Return values
int —getX()
Get x-position
public
getX() : int
Return values
int —getY()
Get y-position
public
getY() : int
Return values
int —parseCss()
Parse CSS string
public
parseCss(string $cssString) : self
Parameters
- $cssString : string
Return values
self —parseCssFile()
Parse CSS file
public
parseCssFile(string $cssFile) : self
Parameters
- $cssFile : string
Return values
self —parseCssUri()
Parse CSS URI
public
parseCssUri(string $cssUri) : self
Parameters
- $cssUri : string
Return values
self —parseFile()
Parse $html from file
public
static parseFile(string $htmlFile[, Document $document = null ]) : self
Parameters
- $htmlFile : string
- $document : Document = null
Return values
self —parseHtml()
Parse HTML string
public
parseHtml(string $htmlString[, string $basePath = null ]) : self
Parameters
- $htmlString : string
- $basePath : string = null
Return values
self —parseHtmlFile()
Parse HTML string from file
public
parseHtmlFile(string $htmlFile) : self
Parameters
- $htmlFile : string
Tags
Return values
self —parseHtmlUri()
Parse HTML string from URI
public
parseHtmlUri(string $htmlUri) : self
Parameters
- $htmlUri : string
Tags
Return values
self —parseString()
Parse HTML string
public
static parseString(string $htmlString[, Document $document = null ]) : self
Parameters
- $htmlString : string
- $document : Document = null
Return values
self —parseUri()
Parse $html from URI
public
static parseUri(string $htmlUri[, Document $document = null ]) : self
Parameters
- $htmlUri : string
- $document : Document = null
Return values
self —prepare()
Prepare for conversion of HTML into PDF objects
public
prepare() : array<string|int, mixed>|Child
Return values
array<string|int, mixed>|Child —process()
Process conversion of HTML into PDF objects
public
process() : Document
Return values
Document —setDefaultStyle()
Set a default style
public
setDefaultStyle(string $property, string $value) : self
Parameters
- $property : string
- $value : string
Return values
self —setDocument()
Set document
public
setDocument(Document $document) : self
Parameters
- $document : Document
Return values
self —setPageBottomMargin()
Set page bottom margin
public
setPageBottomMargin(int $margin) : self
Parameters
- $margin : int
Return values
self —setPageLeftMargin()
Set page left margin
public
setPageLeftMargin(int $margin) : self
Parameters
- $margin : int
Return values
self —setPageMargins()
Set page margins
public
setPageMargins(int $top, int $right, int $bottom, int $left) : self
Parameters
- $top : int
- $right : int
- $bottom : int
- $left : int
Return values
self —setPageRightMargin()
Set page right margin
public
setPageRightMargin(int $margin) : self
Parameters
- $margin : int
Return values
self —setPageSize()
Set page size
public
setPageSize(mixed $size[, mixed $height = null ]) : self
Parameters
- $size : mixed
- $height : mixed = null
Return values
self —setPageTopMargin()
Set page top margin
public
setPageTopMargin(int $margin) : self
Parameters
- $margin : int
Return values
self —setX()
Set x-position
public
setX(int $x) : self
Parameters
- $x : int
Return values
self —setY()
Set y-position
public
setY(int $y) : self
Parameters
- $y : int
Return values
self —addNodeStreamToDocument()
Add node stream to document
protected
addNodeStreamToDocument(Child $child) : void
Parameters
- $child : Child
Tags
Return values
void —addNodeToDocument()
Add node to document
protected
addNodeToDocument(Child $child) : void
Parameters
- $child : Child
Tags
Return values
void —createDefaultStyles()
Create default styles
protected
createDefaultStyles() : void
Return values
void —getCurrentX()
Get current X-position
protected
getCurrentX() : int
Return values
int —getCurrentY()
Get current Y-position
protected
getCurrentY() : int
Return values
int —getStringLines()
Get string lines
protected
getStringLines(string $string, int $fontSize, int $wrapLength, Font $fontObject) : array<string|int, mixed>
Parameters
- $string : string
- $fontSize : int
- $wrapLength : int
- $fontObject : Font
Return values
array<string|int, mixed> —goToNextLine()
Go to next line
protected
goToNextLine(array<string|int, mixed> $styles) : void
Parameters
- $styles : array<string|int, mixed>
Return values
void —newPage()
Create new page
protected
newPage() : int
Return values
int —prepareNodeStyles()
Prepare node styles
protected
prepareNodeStyles(string $name[, array<string|int, mixed> $attribs = [] ][, array<string|int, mixed> $currentStyles = [] ]) : array<string|int, mixed>
Parameters
- $name : string
- $attribs : array<string|int, mixed> = []
- $currentStyles : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed> —resetX()
Reset X-position
protected
resetX() : int
Return values
int —resetY()
Reset Y-position
protected
resetY() : int