category | OSS |
---|---|
package | OSS_Utils |
copyright | Copyright (c) 2007 - 2012, Open Source Solutions Limited, Dublin, Ireland |
license | New BSD License |
HtmlToPdf(string $html, string $pdf, bool $embedFonts) : bool
Please note that the current stable version of htmldoc (v1.8.27) does not support CSS. Make sure PHP has write permission in the output directory. Also don't forget that relative paths are relative to the currently executing PHP script (include() and require() doesn't count in that). Using command line OpenOffice might be a better solution (a necessary macro and a tiny, one line shell script are available on the internet), as it supports everything in the HTML, CSS, images, etc, while the htmldoc 1.9.x is still in "developer snapshot" state.
string
the input HTML file name
string
the output PDF file name
bool
default false embed the used fonts to the genereated PDF or not - can save 100's of kBytes even in a plain PDF (think of email sending)
bool
genUrl(string | bool $controller, string | bool $action, string | bool $module, array $params, string $host) : string
This is a useful function as no knowledge of the application's path is required.
It is also configurable (via Zend_Application config and assuming 'options' is available in Zend_Registry as it would be from OSS_Controller_Action).
You can configure the hostname by setting config: utils.genurl.host_mode
string
bool
default false The controller to call.
string
bool
default false The action to call (controller must be set if setting action)
string
bool
default false The module to use. Set to false to ignore.
array
default array() An array of key value pairs to add to the URL.
string
Defaults to null. Hostname (including http[s]://) to override url with
string
getIniOption(string $option) : mixed
Don't need to use this in the controllers, the $this->_options array is available there, this is useful in models, forms and other places.
todo | : this method is rarely called, but a way to speed it up is to store the key and value in session, and then look for it when called |
---|
string
mixed
getResource(string $resource) : object
Use if Zend_Registry::get() doesn't work. (And in the OSS framework it doesn't.)
string
object
getTempDir() : string
todo | : this method is rarely called, but a way to speed it up is to store the path in session, and then look for it when called |
---|
string
ordinal(int $number) : string
int
string
parseXML(string $XML) : array | bool
string
array
bool
uniformDistHash(int $id, int $length) : string
First it turn given id to hex. Then it appends new hex with leading zeros to reach given length ( 3 by default ) if necessary. And then new string is reversed. From reversed string function takes as many characters as defined in length.
e.g. uniformDistHash( 216 )
returns 8/d/0/216/
uniformDistHash( 7 )
returns 7/0/0/7/
uniformDistHash( 5057 )
returns 1/c/3/5057/
int
Id for making file structure
int
How many levels should be created
string
wkhtmltopdf(string $html, string $pdf) : bool
string
the input HTML file name
string
the output PDF file name
bool