wkhtmltopdf sounds like an excellent solution...the problem is nothing happens on the exec
shell_exec("c:\wkhtmltopdf.exe","http://www.google.com google.pdf");
Am i doing anything wrong?
wkhtmltopdf sounds like an excellent solution...the problem is nothing happens on the exec
shell_exec("c:\wkhtmltopdf.exe","http://www.google.com google.pdf");
Am i doing anything wrong?
「公式」クラスを使用できますか?
http://code.google.com/p/wkhtmltopdf/wiki/IntegrationWithPhp
そうでない場合は、おそらく彼らがどのように物事を行ったかを覗いてみると、実装に役立つでしょう。
// Include WKPDF class.
require_once('wkhtmltopdf/wkhtmltopdf.php');
// Create PDF object.
$pdf = new WKPDF();
// Set PDF's HTML
$pdf->set_html('Hello <b>Mars<.b>!');
// Convert HTML to PDF
$pdf->render();
// Output PDF. The file name is suggested to the browser.
$pdf->output(WKPDF::$PDF_EMBEDDED, 'sample.pdf');
編集:
Github からの新しいリンク - https://github.com/mikehaertl/phpwkhtmltopdf
wkhtmltopdf.exe CLASS_PATH変数へのパスを追加し、phpスクリプトで次のコードを使用します
passthru( "wkhtmltopdf www.gmail.com output.pdf"、$ err);
// PDFヘッダーを出力します('Content-type:application / pdf');
//これはdownloaded.pdfheader('Content-Disposition:attachment; filename = "output.pdf"');と呼ばれます。
// PDFソースはoriginal.pdfにありますreadfile('output.pdf');
私はこれがうまくいくことを願っています...
shell_exec() は 1 つのパラメーターしか取りませんが、2 つ指定しています。代わりにこれを試してください:
shell_exec("c:\wkhtmltopdf.exe http://www.google.com google.pdf");
それで済むと思います。関数の使用を検討することもできexec()
ます。