HTML_ToPDF Class Reference

List of all members.

Public Member Functions

 HTML_ToPdf ($in_htmlFile, $in_domain, $in_pdfFile=null)
 addHtml2PsSettings ($in_settings)
 setDefaultPath ($in_path)
 setDebug ($in_debug)
 setHeader ($in_attribute, $in_value)
 setFooter ($in_attribute, $in_value)
 setTmpDir ($in_path)
 setUseColor ($in_useColor)
 setUseCSS ($in_useCSS)
 setAdditionalCSS ($in_css)
 setGetUrl ($in_getUrl)
 setGrayScale ($in_grayScale)
 setUnderlineLinks ($in_underline)
 setScaleFactor ($in_scale)
 setHtml2Ps ($in_html2ps)
 setPs2Pdf ($in_ps2pdf)
 setMakeAbsoluteImageUrls ($in_makeAbsoluteImageUrls)
 setPs2pdfIncludePath ($in_ps2pdfIncludePath)
 convert ()
 _modifyConfFile ()
 _getCSSFromFile ()
 _convertFontSize ($in_fontString)
 _getPaperSize ()
 _getOrientation ()
 _processHeaderFooter ($in_data)
 _cleanup ($in_files)
 _dumpDebugInfo ($in_info)

Public Attributes

 $htmlFile = ''
 $pdfFile = ''
 $tmpDir = '/tmp'
 $debug = false
 $htmlErrors = false
 $defaultDomain = ''
 $defaultPath = '/'
 $html2psPath = '/usr/bin/html2ps'
 $ps2pdfPath = '/usr/bin/ps2pdf'
 $getUrlPath = '/usr/bin/curl -i'
 $useCSS = true
 $additionalCSS = ''
 $pageInColor = true
 $grayScale = false
 $scaleFactor = 1
 $underlineLinks = null
 $headers = array('left' => '$T', 'right' => '$[author]')
 $footers = array('center' => '- $N -')
 $html2psrc
 $makeAbsoluteImageUrls = true
 $ps2pdfIncludePath = ''
 $_htmlString = ''

Detailed Description

Definition at line 40 of file HTML_ToPDF.php.


Member Function Documentation

HTML_ToPDF::_cleanup in_files  ) 
 

Cleans up the files we created during the script.

Parameters:
array $in_files The array of temporary files
private
Returns:
void

Definition at line 873 of file HTML_ToPDF.php.

References _dumpDebugInfo().

Referenced by convert().

HTML_ToPDF::_convertFontSize in_fontString  ) 
 

Converts textual font size to a numberic representation.

Parameters:
string $in_fontString The font size specification
private
Returns:
string The font-size attribute with size in pt

Definition at line 723 of file HTML_ToPDF.php.

HTML_ToPDF::_dumpDebugInfo in_info  ) 
 

If debug is on it dumps the specified debug information to screen. Uses

 tags
 to save formatting of debug information.

Parameters:
string $in_info The debug info
public
Returns:
void

Definition at line 897 of file HTML_ToPDF.php.

Referenced by _cleanup(), and convert().

HTML_ToPDF::_getCSSFromFile  ) 
 

Try to get the CSS from the html file and use it in creating the PDF file. If we find CSS we'll add it to the CSS string

private

Returns:
string Any CSS found

Definition at line 681 of file HTML_ToPDF.php.

HTML_ToPDF::_getOrientation  ) 
 

Tries to determine the specified page orientaion since html2ps needs to be told explicitly.

private

Returns:
string The page orientation string

Definition at line 809 of file HTML_ToPDF.php.

Referenced by convert().

HTML_ToPDF::_getPaperSize  ) 
 

Tries to determine the specified paper size since ps2pdf needs to be told explicitly in some cases. Right now handles letter, ledger, 11x17, and legal.

private

Returns:
string The page size string

Definition at line 765 of file HTML_ToPDF.php.

Referenced by convert().

HTML_ToPDF::_modifyConfFile  ) 
 

Modify the config file and put in our custom variables

private

Returns:
void

Definition at line 631 of file HTML_ToPDF.php.

References _processHeaderFooter().

Referenced by convert().

HTML_ToPDF::_processHeaderFooter in_data  ) 
 

Process either a set of headers or footers.

Parameters:
array $in_data The header or footer data
private
Returns:
string The html2ps string of data

Definition at line 839 of file HTML_ToPDF.php.

Referenced by _modifyConfFile().

HTML_ToPDF::addHtml2PsSettings in_settings  ) 
 

Adds on more html2ps settings to the end of the default set of settings

Parameters:
string $in_settings The additional settings
public
Returns:
void

Definition at line 230 of file HTML_ToPDF.php.

HTML_ToPDF::convert  ) 
 

Convert the html file into a pdf file

public

Returns:
string The path to the pdf file

Definition at line 510 of file HTML_ToPDF.php.

References $fp, _cleanup(), _dumpDebugInfo(), _getOrientation(), _getPaperSize(), and _modifyConfFile().

HTML_ToPDF::HTML_ToPdf in_htmlFile,
in_domain,
in_pdfFile = null
 

Initializes the class

Parameters:
string $in_htmlFile The full path to the html file to convert
string $in_domain The default domain name for images that have a absolute or relative path
string $in_pdfFile (optional) The full path to the pdf file to output. If not given then we create a temporary name.
public
Returns:
void

Definition at line 209 of file HTML_ToPDF.php.

HTML_ToPDF::setAdditionalCSS in_css  ) 
 

Set additional CSS to use when parsing the html file

Parameters:
string $in_css The additional css
public
Returns:
void

Definition at line 370 of file HTML_ToPDF.php.

HTML_ToPDF::setDebug in_debug  ) 
 

Sets the debug variable

Parameters:
bool $in_debug Turn debugging on or off?
public
Returns:
void

Definition at line 266 of file HTML_ToPDF.php.

HTML_ToPDF::setDefaultPath in_path  ) 
 

Sets the default path for relative paths in images, css etc.

Parameters:
string $in_path A web-path, default is /
public
Returns:
void

Definition at line 245 of file HTML_ToPDF.php.

HTML_ToPDF::setFooter in_attribute,
in_value
 

Sets a footer

Parameters:
string $in_attribute One of the header attributes that html2ps accepts. Most common are left, center, right, font-family, font-size, color.
string $in_value The attribute value. Special values that can be set are $T (document title), $N (page number), $D (current date/time), $U (current url or filename), $[meta-name] (A meta-tag, such as $[author] to get author meta tag)
public
Returns:
void

Definition at line 308 of file HTML_ToPDF.php.

HTML_ToPDF::setGetUrl in_getUrl  ) 
 

Sets the get url which is used for retrieving images from the html file needs to be the full path to the file with options to retrive the headers as well.

Parameters:
string $in_getUrl The get url program
public
Returns:
void

Definition at line 387 of file HTML_ToPDF.php.

HTML_ToPDF::setGrayScale in_grayScale  ) 
 

Sets the gray scale option for images

Parameters:
bool $in_grayScale Images should be in grayscale?
public
Returns:
void

Definition at line 402 of file HTML_ToPDF.php.

HTML_ToPDF::setHeader in_attribute,
in_value
 

Sets a header

Parameters:
string $in_attribute One of the header attributes that html2ps accepts. Most common are left, center, right, font-family, font-size, color.
string $in_value The attribute value. Special values that can be set are $T (document title), $N (page number), $D (current date/time), $U (current url or filename), $[meta-name] (A meta-tag, such as $[author] to get author meta tag)
public
Returns:
void

Definition at line 287 of file HTML_ToPDF.php.

HTML_ToPDF::setHtml2Ps in_html2ps  ) 
 

Sets the path to the html2ps program

Parameters:
string $in_html2ps The html2ps program
public
Returns:
void

Definition at line 448 of file HTML_ToPDF.php.

HTML_ToPDF::setMakeAbsoluteImageUrls in_makeAbsoluteImageUrls  ) 
 

Sets the makeAbsoluteImageUrls variable

Parameters:
bool $in_makeAbsoluteImageUrls Replace relative image URLs in the input HTML file with default domain?
public
Returns:
void

Definition at line 480 of file HTML_ToPDF.php.

HTML_ToPDF::setPs2Pdf in_ps2pdf  ) 
 

Sets the path to the ps2pdf program

Parameters:
string $in_ps2pdf The ps2pdf program
public
Returns:
void

Definition at line 463 of file HTML_ToPDF.php.

HTML_ToPDF::setPs2pdfIncludePath in_ps2pdfIncludePath  ) 
 

Sets the ps2pdfIncludePath() variable

Parameters:
string $in_ps2pdfIncludePath The include path for ps2pdf
public
Returns:
void

Definition at line 496 of file HTML_ToPDF.php.

HTML_ToPDF::setScaleFactor in_scale  ) 
 

Sets the scale factor for the page. Less than one makes it smaller, greater than one enlarges it.

Parameters:
int $in_scale Scale factor
public
Returns:
void

Definition at line 433 of file HTML_ToPDF.php.

HTML_ToPDF::setTmpDir in_path  ) 
 

Set the temporary directory path

Parameters:
string $in_path The full path to the tmp dir
public
Returns:
void

Definition at line 324 of file HTML_ToPDF.php.

HTML_ToPDF::setUnderlineLinks in_underline  ) 
 

Sets the option to underline links or not

Parameters:
bool $in_underline Links should be underlined?
public
Returns:
void

Definition at line 417 of file HTML_ToPDF.php.

HTML_ToPDF::setUseColor in_useColor  ) 
 

Set whether to use color or not when creating the page

Parameters:
bool $in_useColor Use color?
public
Returns:
void

Definition at line 339 of file HTML_ToPDF.php.

HTML_ToPDF::setUseCSS in_useCSS  ) 
 

Set whether to try and use the CSS in the html page when creating the pdf file

Parameters:
bool $in_useCSS Use CSS found in html file?
public
Returns:
void

Definition at line 355 of file HTML_ToPDF.php.


Member Data Documentation

HTML_ToPDF::$_htmlString = ''
 

Definition at line 193 of file HTML_ToPDF.php.

HTML_ToPDF::$additionalCSS = ''
 

Definition at line 115 of file HTML_ToPDF.php.

HTML_ToPDF::$debug = false
 

Definition at line 65 of file HTML_ToPDF.php.

HTML_ToPDF::$defaultDomain = ''
 

Definition at line 78 of file HTML_ToPDF.php.

HTML_ToPDF::$defaultPath = '/'
 

Definition at line 84 of file HTML_ToPDF.php.

HTML_ToPDF::$footers = array('center' => '- $N -')
 

Definition at line 151 of file HTML_ToPDF.php.

HTML_ToPDF::$getUrlPath = '/usr/bin/curl -i'
 

Definition at line 102 of file HTML_ToPDF.php.

HTML_ToPDF::$grayScale = false
 

Definition at line 127 of file HTML_ToPDF.php.

HTML_ToPDF::$headers = array('left' => '$T', 'right' => '$[author]')
 

Definition at line 145 of file HTML_ToPDF.php.

HTML_ToPDF::$html2psPath = '/usr/bin/html2ps'
 

Definition at line 90 of file HTML_ToPDF.php.

HTML_ToPDF::$html2psrc
 

Initial value:

 '
        option {
          titlepage: 0;         /* do not generate a title page */
          toc: 0;               /* no table of contents */
          colour: %pageInColor%; /* create the page in color */
          underline: %underlineLinks%;         /* underline links */
          grayscale: %grayScale%; /* Make images grayscale? */
          scaledoc: %scaleFactor%; /* Scale the document */
        }
        package {
          geturl: %getUrlPath%; /* path to the geturl */
        }
        showurl: 0;             /* do not show the url next to links */'

Definition at line 157 of file HTML_ToPDF.php.

HTML_ToPDF::$htmlErrors = false
 

Definition at line 71 of file HTML_ToPDF.php.

HTML_ToPDF::$htmlFile = ''
 

Definition at line 47 of file HTML_ToPDF.php.

HTML_ToPDF::$makeAbsoluteImageUrls = true
 

Definition at line 180 of file HTML_ToPDF.php.

HTML_ToPDF::$pageInColor = true
 

Definition at line 121 of file HTML_ToPDF.php.

HTML_ToPDF::$pdfFile = ''
 

Definition at line 53 of file HTML_ToPDF.php.

HTML_ToPDF::$ps2pdfIncludePath = ''
 

Definition at line 187 of file HTML_ToPDF.php.

HTML_ToPDF::$ps2pdfPath = '/usr/bin/ps2pdf'
 

Definition at line 96 of file HTML_ToPDF.php.

HTML_ToPDF::$scaleFactor = 1
 

Definition at line 133 of file HTML_ToPDF.php.

HTML_ToPDF::$tmpDir = '/tmp'
 

Definition at line 59 of file HTML_ToPDF.php.

HTML_ToPDF::$underlineLinks = null
 

Definition at line 139 of file HTML_ToPDF.php.

HTML_ToPDF::$useCSS = true
 

Definition at line 109 of file HTML_ToPDF.php.


The documentation for this class was generated from the following file:
Generated on Sat Feb 11 08:43:11 2006 for HTML_ToPDF by  doxygen 1.4.3-20050530