Book/wkhtmltox-Phpdoc专题
wkhtmltox
目录
- 简介
- 安装/配置
- wkhtmltox\PDF\Converter —
The wkhtmltox\PDF\Converter class
- wkhtmltox\PDF\Converter::add — Add an object for conversion
- wkhtmltox\PDF\Converter::__construct — Create a new PDF converter
- wkhtmltox\PDF\Converter::convert — Perform PDF conversion
- wkhtmltox\PDF\Converter::getVersion — Determine version of Converter
- wkhtmltox\PDF\Object — The
wkhtmltox\PDF\Object class
- wkhtmltox\PDF\Object::__construct — Create a new PDF Object
- wkhtmltox\Image\Converter
— The wkhtmltox\Image\Converter class
- wkhtmltox\Image\Converter::__construct — Create a new Image converter
- wkhtmltox\Image\Converter::convert — Perform Image conversion
- wkhtmltox\Image\Converter::getVersion — Determine version of Converter
简介
Converts an HTML input, or set of HTML inputs, into PDF output
类摘要
wkhtmltox\PDF\Converter
class wkhtmltox\PDF\Converter {
/* Constructor */
public <span
class="methodname">__construct ([ <span
class="methodparam">array $settings
] )
/* 方法 */
public void
add ( <span
class="type">wkhtmltox\PDF\Object $object )
public <span class="type">stringnull <span class="methodname">convert ( <span class="methodparam">void )
public string getVersion ( <span class="methodparam">void )
}
wkhtmltox\PDF\Converter::add
Add an object for conversion
说明
public void
wkhtmltox\PDF\Converter::add ( <span
class="methodparam">wkhtmltox\PDF\Object
$object )
Adds the given object to conversion
参数
object
The object to add
wkhtmltox\PDF\Converter::__construct
Create a new PDF converter
说明
public <span
class="methodname">wkhtmltox\PDF\Converter::__construct ([
array
$settings ] )
Creates a PDF converter, using optional configuration settings
参数
settings
| Name | Description | Values | Changelog | ||
|---|---|---|---|---|---|
| size.pageSize | paper size of output document | A4 | >= 0.1.0 | ||
| size.width | with of the output document | 210mm | >= 0.1.0 | ||
| size.height | height of the output document | 297mm | >= 0.1.0 | ||
| orientation | orientation of the output document |
|
>= 0.1.0 | ||
| colorMode | color mode of the output document |
|
>= 0.1.0 | ||
| resolution | resoluition of the output document | most likely has no effect | >= 0.1.0 | ||
| dpi | dpi to use while printing | 80 | >= 0.1.0 | ||
| pageOffset | integer added to page numbers generating headers, footers, and toc | >= 0.1.0 | |||
| copies | >= 0.1.0 | ||||
| collate | collate copies | boolean | >= 0.1.0 | ||
| outline | generate PDF outline | boolean | >= 0.1.0 | ||
| outlineDepth | maximum depth of outline | >= 0.1.0 | |||
| dumpOutline | path of file to dump outline XML | >= 0.1.0 | |||
| out | path of output file, if "-" stdout is used | >= 0.1.0 | |||
| documentTitle | title for the output document | >= 0.1.0 | |||
| useCompression | enable or disable lossless compression | boolean | >= 0.1.0 | ||
| margin.top | size of the top margin | 2cm | >= 0.1.0 | ||
| margin.bottom | size of the bottom margin | 2cm | >= 0.1.0 | ||
| margin.left | size of the left margin | 2cm | >= 0.1.0 | ||
| margin.right | size of the right margin | 2cm | >= 0.1.0 | ||
| imageDPI | maximum DPI for images in the output document | >= 0.1.0 | |||
| imageQuality | the jpeg compression factor for images in the output document | 94 | >= 0.1.0 | ||
| load.cookieJar | path of file used to load and store cookies | /tmp/cookies.txt | >= 0.1.0 |
wkhtmltox\PDF\Converter::convert
Perform PDF conversion
说明
public <span class="type">stringnull <span class="methodname">wkhtmltox\PDF\Converter::convert ( <span class="methodparam">void )
Performs conversion of all previously added Objects
参数
此函数没有参数。
返回值
Where the return value is used, it will be populated with the contents of the conversion buffer
wkhtmltox\PDF\Converter::getVersion
Determine version of Converter
说明
public string wkhtmltox\PDF\Converter::getVersion ( void )
Determines the version of Converter as reported by libwkhtmltox
参数
此函数没有参数。
返回值
Returns a version string
简介
Represents an HTML document, input to PDF converter
类摘要
wkhtmltox\PDF\Object
class wkhtmltox\PDF\Object {
/* Constructor */
public <span
class="methodname">__construct ( <span
class="methodparam">string $buffer
[, array
$settings ] )
}
wkhtmltox\PDF\Object::__construct
Create a new PDF Object
说明
public <span
class="methodname">wkhtmltox\PDF\Object::__construct ( <span
class="methodparam">string $buffer
[, array
$settings ] )
Creates a new PDF Object from the given buffer and optional configuration settings
参数
buffer
HTML
settings
| Name | Description | Values | Changelog | ||||||
|---|---|---|---|---|---|---|---|---|---|
| page | URL or path of the HTML to convert | >= 0.1.0 | |||||||
| useExternalLinks | set true to convert external links in the input into external PDF links in the output | boolean | >= 0.1.0 | ||||||
| useLocalLinks | set true to convert internal links in the input into internal PDF links in the output | boolean | >= 0.1.0 | ||||||
| produceForms | set true to turn HTML forms into PDF forms | boolean | >= 0.1.0 | ||||||
| replacements | undocumented | >= 0.1.0 | |||||||
| includeInOutline | set true to include sections from this object in the outline and toc | boolean | >= 0.1.0 | ||||||
| pagesCount | set true to make page count in toc inclusive of the number of pages in this object | boolean | >= 0.1.0 | ||||||
| tocXsl | set to style sheet to convert this object into a toc object | >= 0.1.0 | |||||||
| toc.useDottedLines | set true to use dotted lines in toc | boolean | >= 0.1.0 | ||||||
| toc.captionText | the caption text for toc | >= 0.1.0 | |||||||
| toc.forwardLinks | set true to create links from toc to content | boolean | >= 0.1.0 | ||||||
| toc.backLinks | set true to create links from content to toc | boolean | >= 0.1.0 | ||||||
| toc.indentation | indentation for toc | 2em | >= 0.1.0 | ||||||
| toc.fontScale | the factor to scale down the font at every toc level | 0.8 | >= 0.1.0 | ||||||
| header.fontSize | font size for use in header | 13 | >= 0.1.0 | ||||||
| header.fontName | name of font for use in header | times | >= 0.1.0 | ||||||
| header.left | text for left of header | >= 0.1.0 | |||||||
| header.center | text for center of header | >= 0.1.0 | |||||||
| header.right | text for right of header | >= 0.1.0 | |||||||
| header.line | enable or disable horizontal rule under header | boolean | >= 0.1.0 | ||||||
| header.spacing | space between header and content | 1.8 | >= 0.1.0 | ||||||
| header.htmlUrl | URL or path of HTML to use in header | >= 0.1.0 | |||||||
| footer.fontSize | font size for use in footer | 13 | >= 0.1.0 | ||||||
| footer.fontName | name of font for use in footer | times | >= 0.1.0 | ||||||
| footer.left | text for left of footer | >= 0.1.0 | |||||||
| footer.center | text for center of footer | >= 0.1.0 | |||||||
| footer.right | text for right of footer | >= 0.1.0 | |||||||
| footer.line | enable or disable horizontal rule under footer | boolean | >= 0.1.0 | ||||||
| footer.spacing | space between footer and content | 1.8 | >= 0.1.0 | ||||||
| footer.htmlUrl | URL or path of HTML to use in footer | >= 0.1.0 | |||||||
| load.username | user name to use when loging into a website | bart | >= 0.1.0 | ||||||
| load.password | the password to used when logging into a website | elbarto | >= 0.1.0 | ||||||
| load.jsdelay | the amount of time in milliseconds to wait after a page is loaded until it is captured | 1200 | >= 0.1.0 | ||||||
| load.zoomFactor | how much zoom should be applied to the content | 2.2 | >= 0.1.0 | ||||||
| load.customHeaders | custom headers to send when requesting the main web page | >= 0.1.0 | |||||||
| load.repertCustomHeaders | set true to send with all requests | boolean | >= 0.1.0 | ||||||
| load.cookies | cookie string to send when requesting the main web page | >= 0.1.0 | |||||||
| load.post | post string to send when requesting the main web page | >= 0.1.0 | |||||||
| load.blockLocalFileAccess | disallow local and piped files to access other local files | boolean | >= 0.1.0 | ||||||
| load.stopSlowScript | stop slow running javascript | boolean | |||||||
| load.debugJavascript | allow javascript to raise warnings | boolean | >= 0.1.0 | ||||||
| load.loadErrorHandling | set error handling strategy |
|
>= 0.1.0 | ||||||
| load.proxy | >= 0.1.0 | ||||||||
| web.background | include background image in output | boolean | >= 0.1.0 | ||||||
| web.loadImages | include images in output | boolean | >= 0.1.0 | ||||||
| web.enableJavascript | enable or disable javascript | boolean | >= 0.1.0 | ||||||
| web.enableIntelligentShrinking | enable to attempt to fit more content on page, only applies to PDF output | boolean | >= 0.1.0 | ||||||
| web.minimumFontSize | the minimum font size allowed | 9 | >= 0.1.0 | ||||||
| web.printMediaType | print content using print media type instead of screen media type | boolean | >= 0.1.0 | ||||||
| web.defaultEncoding | content to use where no encoding is specified | utf-8 | >= 0.1.0 | ||||||
| web.userStyleSheet | URL or path to a user specified style sheet | /path/to/style.css | >= 0.1.0 | ||||||
| web.enablePlugins | enable or disable NS plugins | boolean | >= 0.1.0 |
简介
Converts an HTML input into various image formats
类摘要
wkhtmltox\Image\Converter
class wkhtmltox\Image\Converter {
/* Constructor */
public <span
class="methodname">__construct ([ <span
class="methodparam">string $buffer
[, array
$settings ]] )
/* 方法 */
public <span class="type">stringnull <span class="methodname">convert ( <span class="methodparam">void )
public string getVersion ( <span class="methodparam">void )
}
wkhtmltox\Image\Converter::__construct
Create a new Image converter
说明
public <span
class="methodname">wkhtmltox\Image\Converter::__construct ([
string
$buffer [, <span
class="type">array $settings ]] )
Creates an Image converter, optionally taking an input buffer and configuration settings
参数
buffer
HTML
settings
| Name | Description | Values | Changelog | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| in | URL or path of the input file, if "-" stdin is used | /path/to/markup.html | >= 0.1.0 | ||||||||||
| out | path of output file, if "-" stdout is used, by default an internal buffer is used | /path/to/output.png | >= 0.1.0 | ||||||||||
| fmt | output format to use |
|
>= 0.1.0 | ||||||||||
| transparent | when outputting a PNG or SVG, make the white background transparent | boolean | >= 0.1.0 | ||||||||||
| screenWidth | the with of the screen used to render in pixels | 800 | >= 0.1.0 | ||||||||||
| smartWidth | when true, screenWidth is expanded to the content width | boolean | >= 0.1.0 | ||||||||||
| quality | compression factor to use when outputting a JPEG image | 94 | >= 0.1.0 | ||||||||||
| crop.left | left/x coordinate of the window to capture in pixels | 200 | >= 0.1.0 | ||||||||||
| crop.top | top/y coordinate of the window to capture in pixels | 200 | >= 0.1.0 | ||||||||||
| crop.width | width of the window to capture in pixels | 200 | >= 0.1.0 | ||||||||||
| crop.height | height of the window to capture in pixels | 200 | >= 0.1.0 | ||||||||||
| load.cookieJar | path of file used to load and store cookies | /tmp/cookies.txt | >= 0.1.0 | ||||||||||
| load.username | user name to use when loging into a website | bart | >= 0.1.0 | ||||||||||
| load.password | the password to used when logging into a website | elbarto | >= 0.1.0 | ||||||||||
| load.jsdelay | the amount of time in milliseconds to wait after a page is loaded until it is captured | 1200 | >= 0.1.0 | ||||||||||
| load.zoomFactor | how much zoom should be applied to the content | 2.2 | >= 0.1.0 | ||||||||||
| load.customHeaders | custom headers to send when requesting the main web page | >= 0.1.0 | |||||||||||
| load.repertCustomHeaders | set true to send with all requests | boolean | >= 0.1.0 | ||||||||||
| load.cookies | cookie string to send when requesting the main web page | >= 0.1.0 | |||||||||||
| load.post | post string to send when requesting the main web page | >= 0.1.0 | |||||||||||
| load.blockLocalFileAccess | disallow local and piped files to access other local files | boolean | >= 0.1.0 | ||||||||||
| load.stopSlowScript | stop slow running javascript | boolean | |||||||||||
| load.debugJavascript | allow javascript to raise warnings | boolean | >= 0.1.0 | ||||||||||
| load.loadErrorHandling | set error handling strategy |
|
>= 0.1.0 | ||||||||||
| load.proxy | >= 0.1.0 | ||||||||||||
| web.background | include background image in output | boolean | >= 0.1.0 | ||||||||||
| web.loadImages | include images in output | boolean | >= 0.1.0 | ||||||||||
| web.enableJavascript | enable or disable javascript | boolean | >= 0.1.0 | ||||||||||
| web.enableIntelligentShrinking | enable to attempt to fit more content on page, only applies to PDF output | boolean | >= 0.1.0 | ||||||||||
| web.minimumFontSize | the minimum font size allowed | 9 | >= 0.1.0 | ||||||||||
| web.printMediaType | print content using print media type instead of screen media type | boolean | >= 0.1.0 | ||||||||||
| web.defaultEncoding | content to use where no encoding is specified | utf-8 | >= 0.1.0 | ||||||||||
| web.userStyleSheet | URL or path to a user specified style sheet | /path/to/style.css | >= 0.1.0 | ||||||||||
| web.enablePlugins | enable or disable NS plugins | boolean | >= 0.1.0 |
wkhtmltox\Image\Converter::convert
Perform Image conversion
说明
public <span class="type">stringnull <span class="methodname">wkhtmltox\Image\Converter::convert ( <span class="methodparam">void )
Performs conversion of the input buffer
参数
此函数没有参数。
返回值
Where the return value is used, it will be populated with the contents of the conversion buffer
wkhtmltox\Image\Converter::getVersion
Determine version of Converter
说明
public string wkhtmltox\Image\Converter::getVersion ( void )
Determines the version of Converter as reported by libwkhtmltox
参数
此函数没有参数。
返回值
Returns a version string
Warning
This is not yet implemented by libwkhtmltox