qt4 - wkhtmltopdf 好像需要 Phonon 需要 QCoreApplication::applicationName;为什么?

标签 qt4 screenshot wkhtmltopdf phonon

我正在使用 wkhtmltoimage 并且一切顺利,直到我要求它做 twitter 的屏幕截图并且我得到这个奇怪的错误:

Loading page (1/2)
WARNING: Phonon needs QCoreApplication::applicationName to be set to export audio output names through the DBUS interface 
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
Rendering (2/2)                                                   
Done

这是我使用的命令:
xvfb-run wkhtmltoimage --format png --quality 100 http://twitter.com/jnbdz twitter2.png

我使用的是 Ubuntu 11、Apache2/PHP5 和 Qt4。

当我尝试获取 Google 或其他网站的屏幕截图时,我没有收到此错误。

当它工作时,我只得到这个:http://dl.dropbox.com/u/20599297/twitter3.png

任何想法可能导致此错误?

更新

尝试对 yahoo.com 进行屏幕截图时,我遇到了不同的错误:
xvfb-run wkhtmltoimage --format png --quality 100 http://yahoo.com/ yahoo1.png


Loading page (1/2)
Error: Failed loading page http://yahoo.com/ (sometimes it will work just to ignore this error with --load-error-handling ignore)
Error: Failed loading page http://yahoo.com/ (sometimes it will work just to ignore this error with --load-error-handling ignore)

最佳答案

好的,所以,按顺序:

1/wkhtmltoimage 使用 Webkit,它可能出于多种原因加载 Phonon。例如,为了呈现多媒体 Web 内容。不过,这不是很重要。

2/一些与音频相关的 Phonon 功能需要设置应用程序名称。您可能不需要这些功能来呈现 Web 页面,因此不必担心该警告。

3/Phonon 尝试连接到 Jack 音频服务器失败,大概是因为它扫描可用的音频输出系统。无论如何您都不需要音频,因此您也可以忽略这些错误。

4/据我所知,Twitter 大量使用 JavaScript 进行渲染。我不知道 wkhtmltoimage 附带一个 JavaScript 解释器。因此几乎可以保证渲染问题。

您必须了解 wkhtmltoimage 中使用的方法有些原始并且不是很健壮。在许多情况下它会失败,首先是在处理动态内容时。

您可能会在 http://mobile.twitter.com/ 使用移动版本获得更好的运气。 , 尽管。

至于雅虎错误,它们似乎是与上述任何一个无关的连接错误。

关于qt4 - wkhtmltopdf 好像需要 Phonon 需要 QCoreApplication::applicationName;为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8274942/

相关文章:

css - wkhtmltopdf 或 css 大小(A4、mm、in)的问题

c++ - Visual Studio 编译的 Qt 插件在 Release模式下无法加载

c++ - 自定义 QGraphicsItems 未编译并给出 "object is private"错误

qt4 - Qt4中的USB条码阅读器

java - 知识共享 - Selenium - 当您在 TestNG 中使用监听器进行数百个测试时,对失败的测试进行屏幕截图

phpwkhtmltopdf - 无法创建 PDF - 失败且没有错误消息

qt - win 7 x64 上的 32 位 Qt 应用程序无法运行,但在 Qt Creator 中运行良好?

swift - 使用 Cocos2D/SpriteBuilder 时,使用 UIGraphicsGetImageFromCurrentImageContext 截取的屏幕截图为空白

java - 如何将焦点设置到 java.awt.Robot 中的窗口

php - 无法通过 php 中的 exec() 函数运行 wkhtmltopdf 命令,但相同的命令在命令行上有效