php - 无法在 Mac 上使用 wkhtmltopdf 打印 pdf

标签 php macos ubuntu wkhtmltopdf

我在我的代码点火器应用程序中使用 wkhtmltopdf 库进行打印。我在mac上使用vagrant ubuntu。

网址就像

> http://localhost:8084/{sitename}/{controller_name}/{function}

代码片段是
> $pdf = new WKPDF();
>     // Set PDF's HTML
>     $html_in_string = "<html><body>Content goes here</body></html>";
>     $pdf->set_html($html_in_string);
>     // Convert HTML to PDF
>     $pdf->render();
>     // Output PDF. The file name is suggested to the browser.
>     $pdf->output(WKPDF::$PDF_EMBEDDED, 'print_file_name.pdf');

但它显示“无法加载 PDF 文档”。

PDF 文档不是在缓存/临时文件中创建的。

任何帮助将不胜感激。

最佳答案

请从 url 中删除端口;

http://localhost/{sitename}/{controller_name}/{function}

我希望这能解决这个问题;

关于php - 无法在 Mac 上使用 wkhtmltopdf 打印 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24406660/

相关文章:

php : file path for windows azure code

ios - 如何将 3rd 方框架导入 Xcode Playground?

shell - 在 wget 下载之间等待

javascript - 如何使用 jQuery 数据表使用 onChange 事件获取选定的数据?

php - 如何使用 2 个 sql 构建关联数组?

php - 使用 htaccess 在 Apache 中将 HTTP GET 请求重写为 POST

macos - 发布时崩溃,但调试时不崩溃

macos - MacOSX 10.6 上的 getline 崩溃 C 编译器?

node.js - Ubuntu 16.04 : Unable to correct problems, 你持有损坏的包

ubuntu - 无法在 OCaml 中加载 LLVM 绑定(bind)