djlerman has asked for the wisdom of the Perl Monks concerning the following question:
Hello Wise Monks...
I have the following code running as CGI. It starts to run and returns an empty PDF file to the browser and writes an error message to the error_log.
Do you have any wisdom on how to solve this?
linux: Linux version 2.6.35.6-48.fc14.i686.PAE (...) (gcc version 4.5. +1 20100924 (Red Hat 4.5.1-4) (GCC) ) #1 SMP Fri Oct 22 15:27:53 UTC 2 +010 wkhtmltopdf: wkhtmltopdf 0.10.0 rc2 perl: This is perl 5, version 12, subversion 2 (v5.12.2) built for i38 +6-linux-thread-multi
Thank You in Advance. ~Donavon
perl CODE:
#!/usr/bin/perl #### takes string containing HTML and outputs PDF to browser to downlo +ad #### (otherwise would output to STDOUT) print "Content-Disposition: attachment; filename='testPDF.pdf'\n"; print "Content-type: application/octet-stream\n\n"; my $htmlToPrint = "<html>a bunch of html</html>"; ### open a filehandle and pipe it to wkhtmltopdf ### *the arguments "- -" tell wkhtmltopdf to get ### input from STDIN and send output to STDOUT* open(my $makePDF, "|-", "/usr/local/bin/wkhtmltopdf", "-", "-") || die +("$!"); print $makePDF $htmlToPrint; ## sends my HTML to wkhtmltopdf which st +reams immediately to STDOUT
error_log message:
Loading pages (1/6) QPainter::begin(): Returned false============================] 100% Error: Unable to write to destination
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl wkhtmltopdf Error: Unable to write to destination
by RichardK (Parson) on May 07, 2014 at 16:25 UTC | |
by djlerman (Beadle) on May 07, 2014 at 18:22 UTC | |
by djlerman (Beadle) on May 09, 2014 at 18:25 UTC | |
|
Re: perl wkhtmltopdf Error: Unable to write to destination
by choroba (Cardinal) on May 07, 2014 at 16:19 UTC | |
by djlerman (Beadle) on May 07, 2014 at 17:02 UTC |