HTML::HTMLDoc::PDF - Resulting Document generated by HTML::HTMLDoc


HTML-HTMLDoc documentation Contained in the HTML-HTMLDoc distribution.

Index


Code Index:

NAME

Top

HTML::HTMLDoc::PDF - Resulting Document generated by HTML::HTMLDoc

SYNOPSIS

Top

  print $pdf->to_string();

  $pdf->to_file('/tmp/foo.pdf');




DESCRIPTION

Top

This Module is the result of a HTML::HTMLDoc PDF-generation.

METHODS

Top

to_string()

Method returns the content of the pdf as string. One can use it to send it directly to the browser in a web-environment.

to_file($path)

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.

EXPORT

None by default.

AUTHOR

Top

Michael Frankl - mfrankl@seibert-media.de

SEE ALSO

Top

perl.

HTML::HTMLDoc.


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__