Lines 3-9
package Koha::Borrower::Discharge;
Link Here
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
use CGI; |
4 |
use CGI; |
5 |
use File::Temp qw( :POSIX ); |
5 |
use File::Temp qw( :POSIX ); |
6 |
use HTML::HTMLDoc; |
6 |
use PDF::FromHTML; |
7 |
|
7 |
|
8 |
use C4::Members qw( GetPendingIssues ); |
8 |
use C4::Members qw( GetPendingIssues ); |
9 |
use C4::Reserves qw( GetReservesFromBorrowernumber CancelReserve ); |
9 |
use C4::Reserves qw( GetReservesFromBorrowernumber CancelReserve ); |
Lines 108-117
sub generate_as_pdf {
Link Here
|
108 |
messages => [$letter], |
108 |
messages => [$letter], |
109 |
); |
109 |
); |
110 |
|
110 |
|
111 |
my $pdf_path = tmpnam(); |
111 |
my $html_path = tmpnam() . '.html'; |
112 |
my $htmldoc = new HTML::HTMLDoc(); |
112 |
my $pdf_path = tmpnam() . '.pdf'; |
113 |
$htmldoc->set_html_content($tmpl->output); |
113 |
my $html_content = $tmpl->output; |
114 |
$htmldoc->generate_pdf()->to_file($pdf_path); |
114 |
open my $html_fh, '>', $html_path; |
|
|
115 |
say $html_fh $html_content; |
116 |
close $html_fh; |
117 |
my $pdf = PDF::FromHTML->new( encoding => 'utf-8' ); |
118 |
$pdf->load_file( $html_path ); |
119 |
$pdf->convert; |
120 |
$pdf->write_file( $pdf_path ); |
115 |
|
121 |
|
116 |
return $pdf_path; |
122 |
return $pdf_path; |
117 |
} |
123 |
} |
118 |
- |
|
|