Class: HTML_ToPDF

Source Location: Program_Root/HTML_ToPDF.php

Class Overview [line 39]


A class to convert a local html file to a pdf file on the fly.

Author(s):

Version:

  • 3.1

Copyright:

  • The PHP License

Variables

Methods


Inherited Variables

Inherited Methods



Class Details

A class to convert a local html file to a pdf file on the fly.

Will take a local or remote html file and convert it to a PDF file. Note that you can add encryption or permissions to the PDF file by using the helper PDFEncryptor class that comes with this package. See the README and examples for more information.

Tags:

[ Top ]


Class Variables

$additionalCSS =

[line 106]

Other styles to use when parsing the page

Type: string

Overrides:

[ Top ]

$debug = false

[line 64]

Whether or not we are in debug mode

Type: bool

Overrides:

[ Top ]

$defaultDomain =

[line 76]

The default domain for relative images

Type: string

Overrides:

[ Top ]

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

[line 142]

The footer information

Type: array

Overrides:

[ Top ]

$getUrlPath = /usr/bin/curl -i

[line 94]

The path to your get URL program, including options to get headers

Type: string

Overrides:

[ Top ]

$grayScale = false

[line 118]

Show the images be in grayscale?

Type: bool

Overrides:

[ Top ]

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

[line 136]

The header information

Type: array

Overrides:

[ Top ]

$html2psPath = /usr/bin/html2ps

[line 82]

The path to the html2ps executable

Type: string

Overrides:

[ Top ]

$html2psrc =
        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 */

[line 148]

Default html2ps configuration that we use (is parsed before being used, though)

Type: string

Overrides:

[ Top ]

$htmlErrors = false

[line 70]

Whether we output html errors.

Type: bool

Overrides:

[ Top ]

$htmlFile =

[line 46]

The full path to the file we are parsing

Type: string

Overrides:

[ Top ]

$pageInColor = true

[line 112]

Show the page in color?

Type: bool

Overrides:

[ Top ]

$pdfFile =

[line 52]

The full path to the output file

Type: string

Overrides:

[ Top ]

$ps2pdfPath = /usr/bin/ps2pdf

[line 88]

The path to the ps2pdf executable

Type: string

Overrides:

[ Top ]

$scaleFactor = 1

[line 124]

Scale factore for the page

Type: int

Overrides:

[ Top ]

$tmpDir = /tmp

[line 58]

The temporary directory to save intermediate files

Type: string

Overrides:

[ Top ]

$underlineLinks = null

[line 130]

Whether to underline links or not

Type: bool

Overrides:

[ Top ]

$useCSS = true

[line 100]

Whether or not to try and parse the CSS in the html file and use it in creating the pdf

Type: bool

Overrides:

[ Top ]

$_htmlString =

[line 166]

We use this to store the html file to a string for manipulation

Type: string

Overrides:

[ Top ]


Class Methods

addHtml2PsSettings

void addHtml2PsSettings( string $in_settings)

[line 208]

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

Tags:

  • access - public

Parameters:

  • string $in_settings -

    The additional settings

[ Top ]

convert

string convert( )

[line 433]

Convert the html file into a pdf file

Tags:

  • return -

    The path to the pdf file

  • access - public

Parameters:

[ Top ]

HTML_ToPdf

void HTML_ToPdf( string $in_htmlFile, string $in_domain, [string $in_pdfFile = null])

[line 182]

Initializes the class

Tags:

  • access - public

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 relative path

  • string $in_pdfFile -

    (optional) The full path to the pdf file to output. If not given then we create a temporary name.

[ Top ]

setAdditionalCSS

void setAdditionalCSS( string $in_css)

[line 327]

Set additional CSS to use when parsing the html file

Tags:

  • access - public

Parameters:

  • string $in_css -

    The additional css

[ Top ]

setDebug

void setDebug( bool $in_debug)

[line 223]

Sets the debug variable

Tags:

  • access - public

Parameters:

  • bool $in_debug -

    Turn debugging on or off?

[ Top ]

setFooter

void setFooter( string $in_attribute, string $in_value)

[line 265]

Sets a footer

Tags:

  • access - public

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)

[ Top ]

setGetUrl

void setGetUrl( string $in_getUrl)

[line 344]

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.

Tags:

  • access - public

Parameters:

  • string $in_getUrl -

    The get url program

[ Top ]

setGrayScale

void setGrayScale( bool $in_grayScale)

[line 359]

Sets the gray scale option for images

Tags:

  • access - public

Parameters:

  • bool $in_grayScale -

    Images should be in grayscale?

[ Top ]

setHeader

void setHeader( string $in_attribute, string $in_value)

[line 244]

Sets a header

Tags:

  • access - public

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)

[ Top ]

setHtml2Ps

void setHtml2Ps( string $in_html2ps)

[line 405]

Sets the path to the html2ps program

Tags:

  • access - public

Parameters:

  • string $in_html2ps -

    The html2ps program

[ Top ]

setPs2Pdf

void setPs2Pdf( string $in_ps2pdf)

[line 420]

Sets the path to the ps2pdf program

Tags:

  • access - public

Parameters:

  • string $in_ps2pdf -

    The ps2pdf program

[ Top ]

setScaleFactor

void setScaleFactor( int $in_scale)

[line 390]

Sets the scale factor for the page.

Less than one makes it smaller, greater than one enlarges it.

Tags:

  • access - public

Parameters:

  • int $in_scale -

    Scale factor

[ Top ]

setTmpDir

void setTmpDir( string $in_path)

[line 281]

Set the temporary directory path

Tags:

  • access - public

Parameters:

  • string $in_path -

    The full path to the tmp dir

[ Top ]

setUnderlineLinks

void setUnderlineLinks( bool $in_underline)

[line 374]

Sets the option to underline links or not

Tags:

  • access - public

Parameters:

  • bool $in_underline -

    Links should be underlined?

[ Top ]

setUseColor

void setUseColor( bool $in_useColor)

[line 296]

Set whether to use color or not when creating the page

Tags:

  • access - public

Parameters:

  • bool $in_useColor -

    Use color?

[ Top ]

setUseCSS

void setUseCSS( bool $in_useCSS)

[line 312]

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

Tags:

  • access - public

Parameters:

  • bool $in_useCSS -

    Use CSS found in html file?

[ Top ]

_dumpDebugInfo

void _dumpDebugInfo( string $in_info)

[line 790]

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

Tags:

  • access - public

Parameters:

  • string $in_info -

    The debug info

[ Top ]


Documention generated on Wed, 6 Aug 2003 15:00:17 -0500 by phpDocumentor 1.2.0