How do I get WKHTMLTOPDF to execute via PHP?

后端 未结 7 1883
孤街浪徒
孤街浪徒 2020-11-29 00:28

This has been asked to some degree before but there are no solutions or accepted answers and I\'d like to try and be more comprehensive in my question so:

I\'m tryin

7条回答
  •  佛祖请我去吃肉
    2020-11-29 01:08

    You can also try my project here. It provides a clean OO interface to the command line utility:

    https://github.com/mikehaertl/phpwkhtmltopdf

    Usage is very simple:

    addPage('/home/joe/page.html');
    $pdf->addPage('....');
    $pdf->addPage('http://google.com');
    
    // Add a cover (same sources as above are possible)
    $pdf->addCover('mycover.html');
    
    // Add a Table of contents
    $pdf->addToc();
    
    // Save the PDF
    $pdf->saveAs('/tmp/new.pdf');
    
    // ... or send to client for inline display
    $pdf->send();
    

提交回复
热议问题