Problem # 1 (Solved):

After a clean install of Debian 7 + ISPManager 5, phpwkhtmltopdf stopped working.

In console by command

wkhtmltopdf http://www.google.ru gog.pdf 

everything works fine, but through the phpwkhtmltopdf script

 $pdf = new Pdf('http://www.google.ru'); $pdf->saveAs('/gog.pdf'); print_r($pdf->getError()); 

gives an error message

Segmentation fault.

If you use phpwkhtmltopdf already to the full (add your CSS, add settings, etc.), it gives the following error:

Xvfb-run --server-args = "- screen 0, 1024x768x24" wkhtmltopdf --orientation 'Portrait' --margin-right '0' --margin-left '1' --margin-bottom ' 5 '--margin-top' 10 '--page-size' A4 '--use-xserver --user-style-sheet' /path/to/pdf.css' '/path/to/file.html' '.pdf'

In this case, before reinstalling the system, everything worked fine. I can assume that after the reinstallation I forgot to include something somewhere, but I don’t have a clue what. Maybe someone had a similar situation?

Here is the complete object:

 mikehaertl\wkhtmlto\Pdf Object ( [binary] => wkhtmltopdf [commandOptions] => Array ( ) [tmpDir] => [ignoreWarnings] => [version9] => [_isCreated:protected] => [_options:protected] => Array ( ) [_objects:protected] => Array ( [0] => Array ( [inputArg] => http://www.google.ru ) ) [_tmpPdfFile:protected] => mikehaertl\tmp\File Object ( [_fileName:protected] => .pdf ) [_tmpFiles:protected] => Array ( ) [_command:protected] => mikehaertl\wkhtmlto\Command Object ( [enableXvfb] => [xvfbRunBinary] => xvfb-run [xvfbRunOptions] => --server-args="-screen 0, 1024x768x24" [escapeArgs] => 1 [escapeCommand] => [useExec] => [captureStdErr] => 1 [procCwd] => [procEnv] => [procOptions] => [locale] => [_command:protected] => wkhtmltopdf [_args:protected] => Array ( [0] => 'http://www.google.ru' [1] => '.pdf' ) [_execCommand:protected] => wkhtmltopdf 'http://www.google.ru' '.pdf' [_stdOut:protected] => [_stdErr:protected] => Segmentation fault [_exitCode:protected] => 139 [_error:protected] => Segmentation fault [_executed:protected] => ) [_error:protected] => Segmentation fault ) 

Problem # 2:

After the manual installation of PHP, Wkhtmltopdf began to issue empty PDFs, in the output he writes:

 [_stdOut:protected] => The switch --use-xserver, is not support using unpatched qt, and will be ignored.Loading page (1/2) [> ] 0% [======> ] 10% [===================> ] 33% [======================> ] 38% [============================> ] 47% [==============================> ] 50% [=====================================> ] 62% [=======================================> ] 66% [===============================================> ] 79% [=================================================> ] 83% [============================================================] 100% Printing pages (2/2) QPainter::begin(): Returned false [> ] Done 

I understand that the keywords here is not support using unpatched qt and QPainter::begin(): Returned false . But strangely, I have patched Wkhtmltopdf, and everything works as it should from the console. Maybe someone came across this?

  • After "proc_open ()" in "$ pipe [1]" I found the error "wkhtmltopdf: symbol lookup error: wkhtmltopdf: undefined symbol: _ZN12QWebSettings20setPrintingMediaTypeERK7QString" - maybe that's the point, but what kind of character is this? - xXxxX
  • binding to some library. probably need to rebuild the program. - aleksandr barakin

1 answer 1

I'm not sure that this is the solution, but through more than a dozen reinstallations, it turned out that QT should be installed via https://github.com/wkhtmltopdf/qt/archive/wk_4.8.7.zip

I also put on https://github.com/jcsalterego/wkhtmltopdf-qt/archive/staging.zip

Although it is possible that the decision was different. But now everything works.