#!/usr/bin/perl use warnings; use strict; use IPC::Open3; use Symbol; my $cmd = '/usr/local/bin/wkhtmltopdf - -'; my $err = gensym(); my $in = gensym(); my $out = gensym(); my $pdf = ''; my $pid = open3($in, $out, $err, $cmd) or die "could not run cmd : $cmd : $!\n"; my $string = 'Hello World!!!


IMG: '; print $in $string; close($in); while( <$out> ) { $pdf .= $_ } # for trouble shooting while( <$err> ) { # print "err-> $_
\n"; } # for trouble shooting waitpid($pid, 0 ) or die "$!\n"; my $retval = $?; # print "retval-> $retval
\n"; print "Content-Disposition: attachment; filename='testPDF.pdf'\n"; print "Content-type: application/octet-stream\n\n"; print $pdf;