Class PDF::HTMLDoc
In: lib/htmldoc.rb
Parent: Object

The wrapper class around HTMLDOC, providing methods for setting the options for the application and retriving the generate output either as a file, diretory or string.

Methods

<<   add_page   create   footer   generate   header   new   program_path   program_path=   set_option  

Attributes

errors  [R]  The last error messages generate by the command. It’s a hash where they key represents the error number, and the value represents the error message. If the error number is zero, HTMLDOC was called with invalid parameters. Errors can happen even if generation succeeds, for example, if an image can’t be found in the course of the generation.
result  [R]  The last result from the generation of the output file(s). It’s a hash comprising three pairs:
bytes:The number of bytes generated in the last request or nil
pages:The number of pages generated in the last request or nil
output:The raw output of the command

Public Class methods

Creates a blank HTMLDOC wrapper and passes it to a block. When the block finishes running, the generate method is automatically called. The result of generate is then passed back to the application.

Creates a blank HTMLDOC wrapper, using format to indicate whether the output will be HTML, PDF or PS. The format defaults to PDF, and can change using one of the module contants.

Gets the current path for the HTMLDOC executable. This is a class method.

Sets the current path for the HTMLDOC executable. This is a class method.

Public Instance methods

<<(page)

Alias for add_page

Adds a page for generation. The page can be a URL beginning with either http:// or https://; a file, which will be verified for existence; or any text.

Sets the footer. It’s the same as set_option :footer, value.

Invokes HTMLDOC and generates the output. If an output directory or file is provided, the method will return true or false to indicate completion. If no output directory or file is provided, it will return a string representing the entire output. Generate will raise a PDF::HTMLDocException if the program path can’t be found.

Sets the header. It’s the same as set_option :header, value.

Sets an option for the wrapper. Only valid HTMLDOC options will be accepted. The name of the option is a symbol, but the value can be anything. Invalid options will throw an exception. To unset an option, use nil as the value. Options with negated counterparts, like :encryption, can be set using :no or :none as the value.

[Validate]