wkhtmltopdf codeigniter
-
28-09-2019 - |
質問
wkhtmltopdfは優れた解決策のように聞こえます...問題は幹部に何も起こらないことです
shell_exec( "c: wkhtmltopdf.exe"、 "http://www.google.com Google.pdf ");
私は何か間違ったことをしていますか?
解決
「公式」クラスを使用できますか?
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');
編集:
githubsからの新しいリンク - https://github.com/mikehaertl/phpwkhtmltopdf
他のヒント
shell_exec()は1つのパラメーターのみを取得しますが、2つを指定しました。代わりにこれを試してください:
shell_exec("c:\wkhtmltopdf.exe http://www.google.com google.pdf");
私はそれがそれをするだろうと思います。また、を使用することも検討する場合があります exec()
働き。
wkhtmltopdf.exe class_path変数にパスを追加し、phpスクリプトでbellowコードを使用します
passthru( "wkhtmltopdf www.gmail.com output.pdf"、$ err);
// PDFヘッダー( 'Content-Type:Application/PDF')を出力します。
// downloaded.pdf headerと呼ばれます( 'content-disposition:attachment; filename = "output.pdf"');
// PDFソースはOriginal.pdf readfile( 'output.pdf');
これがうまくいくことを願っています...