George_Sherston has asked for the wisdom of the Perl Monks concerning the following question:
This does one of two things with any new bit of data: either it prints it to a previously opened file handle, or it stores it in the pdf object for, AFAIK ultimate dumping to... filehandle? (not sure - I'm afraid the close sub is a bit beyond me - it seems to call itself from within itself, though I'm sure there's more to it than that).sub add { my $self = shift; my $data = join '', @_; $self->{'size'} += length $data; if (defined $self->{'fh'}) { my $fh = $self->{'fh'}; print $fh $data; } else { $self->{'data'} .= $data; } }
Now it works (I include a pdf header in my script) - the pdf appears straight on the browser screen as desired, with no intermediate saving and retrieving.sub add { #I, George Sherston, edited this function 6/2002; my $self = shift; my $data = join '', @_; $self->{'size'} += length $data; # if (defined $self->{'fh'}) { # my $fh = $self->{'fh'}; # print $fh $data; print $data; # } # else { # $self->{'data'} .= $data; # } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: PDF::Create - send output to STDOUT?
by shotgunefx (Parson) on Jun 04, 2002 at 09:23 UTC | |
Re: PDF::Create - found a SOLUTION quite by chance!
by George_Sherston (Vicar) on Jun 04, 2002 at 11:57 UTC | |
by shotgunefx (Parson) on Jun 04, 2002 at 12:11 UTC | |
by elwarren (Priest) on Jun 04, 2002 at 16:00 UTC | |
Re: PDF::Create - send output to STDOUT?
by Aristotle (Chancellor) on Jun 04, 2002 at 12:13 UTC | |
Re: PDF::Create - send output to STDOUT?
by George_Sherston (Vicar) on Jun 04, 2002 at 09:30 UTC | |
by shotgunefx (Parson) on Jun 04, 2002 at 11:17 UTC | |
Re: PDF::Create - send output to STDOUT?
by Joost (Canon) on Jun 04, 2002 at 15:16 UTC | |
Re: PDF::Create - send output to STDOUT?
by jmcnamara (Monsignor) on Jun 04, 2002 at 12:23 UTC |