| HTML-HTMLDoc documentation | Contained in the HTML-HTMLDoc distribution. |
HTML::HTMLDoc::PDF - Resulting Document generated by HTML::HTMLDoc
print $pdf->to_string();
$pdf->to_file('/tmp/foo.pdf');
This Module is the result of a HTML::HTMLDoc PDF-generation.
Method returns the content of the pdf as string. One can use it to send it directly to the browser in a web-environment.
Write the PDF-content directly to a file specified by $path. Returns FALSE if errors occured opening or writing to the file, TRUE on success.
None by default.
Michael Frankl - mfrankl@seibert-media.de
perl.
| HTML-HTMLDoc documentation | Contained in the HTML-HTMLDoc distribution. |
package HTML::HTMLDoc::PDF; use 5.006; use strict; use warnings; use IO::File; use vars qw(@ISA $VERSION); @ISA = qw(); $VERSION = '0.09'; ############### # create a new Object # param: # return: object:HTML::HTMLDOC ############### sub new { my $package = shift; my $contentref = shift; return undef if (ref($contentref) ne 'SCALAR'); my $self = {}; bless($self, $package); $self->{'content'} = $contentref; return $self; } ############### # returns the content as string # param: # return: conent:STRING ############### sub to_string { my $self = shift; return ${$self->{'content'}}; } ############### # writes the output to a file # specified by filename # param: filename|STRING # return: ############### sub to_file { my $self = shift; my $filename = shift; my $file = new IO::File($filename, "w"); if (!$file) { return 0; } print $file ${$self->{'content'}}; $file->close(); return 1; } 1; __END__