google-chrome - Ubuntu 中的 Chrome headless (headless)

标签 google-chrome ubuntu pdf headless

我正在尝试使用 chrome headless print to pdf 选项在 ubuntu 中打印一些 pdf 文件,这是我的命令行:

google-chrome --headless --disable-gpu --print-to-pdf  http://www.google.com

现在,如果我像这样运行它,它会完美运行并生成文件。

但是 当我在 --print-to-pdf 之后添加文件名时:
google-chrome --headless --disable-gpu --print-to-pdf gen.pdf http://www.google.com

发生错误:
[1213/020159.194304:ERROR:headless_shell.cc(605)] Open multiple tabs is only supported when remote debugging is enabled.

有什么解决办法吗?谢谢。

最佳答案

你错过了 = --print-to-pdf之间和 gen.pdf .

这应该有效:
google-chrome --headless --disable-gpu --print-to-pdf=gen.pdf http://www.google.com
类似问题问 here

关于google-chrome - Ubuntu 中的 Chrome headless (headless),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47790308/

相关文章:

css - 无法为动画设置路由器导出的不透明度 [Chrome]

javascript - FireFox 和 Google Chrome 中不同的 JavaScript 对象文字行为?

css - 为什么 Bootstrap Glyphicons 仅在 Google Chrome 中调试时出现?

ruby-on-rails - 在安装 RubyGems 1.7.2 时,它安装了 1.3.5

php - 在 ubuntu 14.04 PHP 版本 5.5.9-1ubuntu4.6(64 位服务器)上安装 PDFlib 时出现问题

google-chrome - 重新启用扩展安装

python - 使用 Docker 的名称解析 [Errno -3] 暂时失败

ubuntu - Linux删除行不删除最大值

javascript - PDF对象 : How to reload container with a different copy of the same file?

pdf - 让 phantomjs 1.9.8 正确渲染 PDF 中 HTML 表格单元格的边框