|
Lines 21-26
use strict;
Link Here
|
| 21 |
use warnings; |
21 |
use warnings; |
| 22 |
use PDF::Reuse; |
22 |
use PDF::Reuse; |
| 23 |
use PDF::Reuse::Barcode; |
23 |
use PDF::Reuse::Barcode; |
|
|
24 |
use File::Temp; |
| 24 |
|
25 |
|
| 25 |
BEGIN { |
26 |
BEGIN { |
| 26 |
use version; our $VERSION = qv('1.0.0_1'); |
27 |
use version; our $VERSION = qv('1.0.0_1'); |
|
Lines 42-48
sub new {
Link Here
|
| 42 |
delete($opts{InitVars}); |
43 |
delete($opts{InitVars}); |
| 43 |
prDocDir($opts{'DocDir'}) if $opts{'DocDir'}; |
44 |
prDocDir($opts{'DocDir'}) if $opts{'DocDir'}; |
| 44 |
delete($opts{'DocDir'}); |
45 |
delete($opts{'DocDir'}); |
| 45 |
prFile(%opts); |
46 |
|
|
|
47 |
my $fh = File::Temp->new( UNLINK => 0, SUFFIX => '.pdf' ); |
| 48 |
$opts{Name} = $self->{filename} = "$fh"; # filename |
| 49 |
close $fh; # we need just filename |
| 50 |
|
| 51 |
prFile(\%opts); |
| 46 |
bless ($self, $type); |
52 |
bless ($self, $type); |
| 47 |
return $self; |
53 |
return $self; |
| 48 |
} |
54 |
} |
|
Lines 52-57
sub End {
Link Here
|
| 52 |
# if the pdf stream is utf8, explicitly set it to utf8; this avoids at lease some wide character errors -chris_n |
58 |
# if the pdf stream is utf8, explicitly set it to utf8; this avoids at lease some wide character errors -chris_n |
| 53 |
utf8::encode($PDF::Reuse::stream) if utf8::is_utf8($PDF::Reuse::stream); |
59 |
utf8::encode($PDF::Reuse::stream) if utf8::is_utf8($PDF::Reuse::stream); |
| 54 |
prEnd(); |
60 |
prEnd(); |
|
|
61 |
|
| 62 |
# slurp temporary filename and print it out for plack to pick up |
| 63 |
local $/ = undef; |
| 64 |
open(my $fh, '<', $self->{filename}) || die "$self->{filename}: $!"; |
| 65 |
print <$fh>; |
| 66 |
close $fh; |
| 67 |
unlink $self->{filename}; |
| 55 |
} |
68 |
} |
| 56 |
|
69 |
|
| 57 |
sub Add { |
70 |
sub Add { |
| 58 |
- |
|
|