在 xampp 上安装 mikehaertl-phpwkhtmltopdf - 对于傻瓜 [英] Installation of mikehaertl-phpwkhtmltopdf on xampp - for dummies

查看:80
本文介绍了在 xampp 上安装 mikehaertl-phpwkhtmltopdf - 对于傻瓜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用这篇文章:如何让 WKHTMLTOPDF 通过 PHP 执行? 但我遗漏了一些东西.

I've tried to use this post: How do I get WKHTMLTOPDF to execute via PHP? but I'm missing something.

我希望这里有一个真正的傻瓜指南......

I'm hoping for a real dummies guide here...

在 windows/xampp/codeigniter 上安装 mikehaertl-phpwkhtmltopdf

  1. 获取并安装 wkhtmltopdf.这通常会安装到 C:\program files\wkhtmltopdf\lib 或 Windows 上的类似位置.
  2. 获取并解压 Mikehaertl 的包装器(例如 wkhtmltox-win64_0.12.0-03c001d)
  3. 将 WkHtmlToPdf.php 文件放在 ???????
  4. 我是否编辑 WkHtmlToPdf.php 文件并输入
    • binPath (C:\program files\wkhtmltopdf\lib) ????
    • 输出文件夹????

现在用

shell_exec("c:/programs/wkhtmltopdf/wkhtmltopdf.exe http://www.google.com c:/google.pdf");

正如我可能提到的……真正的傻瓜指南.:(

As I may have mentioned... the real dummies guide. :(

推荐答案

(老问题我知道,但也花了很多时间弄清楚他的例子:|)

(Old question I know, but spent a fair bit of time figuring out his example as well :|)

1) 安装 wkhtmltopdf(用于 Bin 文件)和 Mike 的文件 @ https://github.com/mikehaertl/phpwkhtmltopdf

1) Install wkhtmltopdf (for the Bin files) and Mike's files @ https://github.com/mikehaertl/phpwkhtmltopdf

2) 复制所有 wkhtmltopdf &Mike 的文件到您的 codeigniter 文件夹中的所需位置.

2) Copy all of wkhtmltopdf & Mike's files to a desired location in your codeigniter folder.

3) 要重新创建 Mikes 示例,您可以创建他的 demo.html(或使用实际链接)和 pdf.css(没有 css 也可以工作),但是在他的 php 示例中,您将调用,前几行是这样的(他在文档中巧妙地提到了这些要求):

3) To recreate Mikes example, you can create his demo.html (or use an actual link) and pdf.css (no css will also work), however in his php example, you'll be calling on, the first few lines go like this (he subtly mentions these requirements in the documentation):

require_once('WkHtmlToPdf.php'); // link to where you placed Mike's WkHtmlToPdf.php


// Create a new WKHtmlToPdf object with some global PDF options
$pdf = new WkHtmlToPdf(array(
'binPath' => '/wkhtmltopdf/bin/wkhtmltopdf.exe', // link to where placed your bin files

 ... // rest of code

 $pdf->addPage('demo.html'); // or something like $pdf->addPage('http://google.com');
 $pdf->send();
 // or $pdf->saveAs('/save/to/see/your/new.pdf'); 

希望有帮助

这篇关于在 xampp 上安装 mikehaertl-phpwkhtmltopdf - 对于傻瓜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆