Parser
in package
Pdf HTML parser class
Tags
Table of Contents
Properties
- $css : Css|null
- CSS object
- $defaultStyles : array<string|int, mixed>
- Default styles
- $document : Document|null
- PDF document
- $fileDir : string|null
- HTML file directory
- $html : Child|array<string|int, mixed>|null
- HTML object or array of HTML objects
- $page : Page|null
- Current page object
- $pageMargins : array<string|int, mixed>
- Page margins
- $pageSize : string
- Page size
- $textWrap : Wrap|null
- Text wrap object
- $x : int
- Current x-position
- $y : int
- Current y-position
- $yOverride : int|null
- Y-override
Methods
- __construct() : mixed
- Constructor
- document() : Document|null
- Get document (alias)
- getCss() : Css|null
- Get styles
- getDefaultStyle() : string|null
- Get a default style
- getDefaultStyles() : array<string|int, mixed>
- Get default styles
- getDocument() : Document|null
- Get document
- getHtml() : array<string|int, mixed>|Child|null
- 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() : Parser
- Parse CSS string
- parseCssFile() : Parser
- Parse CSS file
- parseCssUri() : Parser
- Parse CSS URI
- parseFile() : Parser
- Parse $html from file
- parseHtml() : Parser
- Parse HTML string
- parseHtmlFile() : Parser
- Parse HTML string from file
- parseHtmlUri() : Parser
- Parse HTML string from URI
- parseString() : Parser
- Parse HTML string
- parseUri() : Parser
- Parse $html from URI
- prepare() : array<string|int, mixed>|Child|null
- Prepare for conversion of HTML into PDF objects
- process() : Document|null
- Process conversion of HTML into PDF objects
- setDefaultStyle() : Parser
- Set a default style
- setDocument() : Parser
- Set document
- setPageBottomMargin() : Parser
- Set page bottom margin
- setPageLeftMargin() : Parser
- Set page left margin
- setPageMargins() : Parser
- Set page margins
- setPageRightMargin() : Parser
- Set page right margin
- setPageSize() : Parser
- Set page size
- setPageTopMargin() : Parser
- Set page top margin
- setX() : Parser
- Set x-position
- setY() : Parser
- 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|null
$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|null
$document
= null
$fileDir
HTML file directory
protected
string|null
$fileDir
= null
$html
HTML object or array of HTML objects
protected
Child|array<string|int, mixed>|null
$html
= null
$page
Current page object
protected
Page|null
$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|null
$textWrap
= null
$x
Current x-position
protected
int
$x
= 0
$y
Current y-position
protected
int
$y
= 0
$yOverride
Y-override
protected
int|null
$yOverride
= null
Methods
__construct()
Constructor
public
__construct([Document|null $document = null ]) : mixed
Instantiate the HTML parser object
Parameters
- $document : Document|null = null
document()
Get document (alias)
public
document() : Document|null
Return values
Document|nullgetCss()
Get styles
public
getCss() : Css|null
Return values
Css|nullgetDefaultStyle()
Get a default style
public
getDefaultStyle(string $property) : string|null
Parameters
- $property : string
Return values
string|nullgetDefaultStyles()
Get default styles
public
getDefaultStyles() : array<string|int, mixed>
Return values
array<string|int, mixed>getDocument()
Get document
public
getDocument() : Document|null
Return values
Document|nullgetHtml()
Get HTML nodes
public
getHtml() : array<string|int, mixed>|Child|null
Return values
array<string|int, mixed>|Child|nullgetPageBottomMargin()
Get page bottom margin
public
getPageBottomMargin() : int
Return values
intgetPageLeftMargin()
Get page left margin
public
getPageLeftMargin() : int
Return values
intgetPageMargins()
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
intgetPageSize()
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
intgetX()
Get x-position
public
getX() : int
Return values
intgetY()
Get y-position
public
getY() : int
Return values
intparseCss()
Parse CSS string
public
parseCss(string $cssString) : Parser
Parameters
- $cssString : string
Return values
ParserparseCssFile()
Parse CSS file
public
parseCssFile(string $cssFile) : Parser
Parameters
- $cssFile : string
Tags
Return values
ParserparseCssUri()
Parse CSS URI
public
parseCssUri(string $cssUri) : Parser
Parameters
- $cssUri : string
Return values
ParserparseFile()
Parse $html from file
public
static parseFile(string $htmlFile[, Document|null $document = null ]) : Parser
Parameters
- $htmlFile : string
- $document : Document|null = null
Tags
Return values
ParserparseHtml()
Parse HTML string
public
parseHtml(string $htmlString[, string|null $basePath = null ]) : Parser
Parameters
- $htmlString : string
- $basePath : string|null = null
Return values
ParserparseHtmlFile()
Parse HTML string from file
public
parseHtmlFile(string $htmlFile) : Parser
Parameters
- $htmlFile : string
Tags
Return values
ParserparseHtmlUri()
Parse HTML string from URI
public
parseHtmlUri(string $htmlUri) : Parser
Parameters
- $htmlUri : string
Return values
ParserparseString()
Parse HTML string
public
static parseString(string $htmlString[, Document|null $document = null ]) : Parser
Parameters
- $htmlString : string
- $document : Document|null = null
Return values
ParserparseUri()
Parse $html from URI
public
static parseUri(string $htmlUri[, Document|null $document = null ]) : Parser
Parameters
- $htmlUri : string
- $document : Document|null = null
Return values
Parserprepare()
Prepare for conversion of HTML into PDF objects
public
prepare() : array<string|int, mixed>|Child|null
Return values
array<string|int, mixed>|Child|nullprocess()
Process conversion of HTML into PDF objects
public
process() : Document|null
Tags
Return values
Document|nullsetDefaultStyle()
Set a default style
public
setDefaultStyle(string $property, string $value) : Parser
Parameters
- $property : string
- $value : string
Return values
ParsersetDocument()
Set document
public
setDocument(Document $document) : Parser
Parameters
- $document : Document
Return values
ParsersetPageBottomMargin()
Set page bottom margin
public
setPageBottomMargin(int $margin) : Parser
Parameters
- $margin : int
Return values
ParsersetPageLeftMargin()
Set page left margin
public
setPageLeftMargin(int $margin) : Parser
Parameters
- $margin : int
Return values
ParsersetPageMargins()
Set page margins
public
setPageMargins(int $top, int $right, int $bottom, int $left) : Parser
Parameters
- $top : int
- $right : int
- $bottom : int
- $left : int
Return values
ParsersetPageRightMargin()
Set page right margin
public
setPageRightMargin(int $margin) : Parser
Parameters
- $margin : int
Return values
ParsersetPageSize()
Set page size
public
setPageSize(mixed $size[, mixed $height = null ]) : Parser
Parameters
- $size : mixed
- $height : mixed = null
Return values
ParsersetPageTopMargin()
Set page top margin
public
setPageTopMargin(int $margin) : Parser
Parameters
- $margin : int
Return values
ParsersetX()
Set x-position
public
setX(int $x) : Parser
Parameters
- $x : int
Return values
ParsersetY()
Set y-position
public
setY(int $y) : Parser
Parameters
- $y : int
Return values
ParseraddNodeStreamToDocument()
Add node stream to document
protected
addNodeStreamToDocument(Child $child) : void
Parameters
- $child : Child
Tags
addNodeToDocument()
Add node to document
protected
addNodeToDocument(Child $child) : void
Parameters
- $child : Child
Tags
createDefaultStyles()
Create default styles
protected
createDefaultStyles() : void
getCurrentX()
Get current X-position
protected
getCurrentX() : int
Return values
intgetCurrentY()
Get current Y-position
protected
getCurrentY() : int
Return values
intgetStringLines()
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>
newPage()
Create new page
protected
newPage() : int
Return values
intprepareNodeStyles()
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
intresetY()
Reset Y-position
protected
resetY() : int