mikehaertl / phpwkhtmltopdf

A slim PHP wrapper around wkhtmltopdf with an easy to use and clean OOP interface
MIT License
1.6k stars 238 forks source link

Error QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-www-data #401

Closed Gabriel-Hen closed 1 year ago

Gabriel-Hen commented 1 year ago

When I try to save or send or convert to string a pdf with multiples addPage(html), return this error. But if i try with only one addPage(html) the pdf is saved

mikehaertl commented 1 year ago

This error is not thrown by our library but rather by wkhtmltopdf itself. I found this:

I don't think there's much we can do about it here.

mikehaertl commented 1 year ago

You could also try to set that var to a writeable directory:


<?php
$pdf = new Pdf(array(
    'commandOptions' => array(
        'procEnv' => array(
            // provide a path to a writeable dir here
            // sys_get_temp_dir() should usually work:
            'XDG_RUNTIME_DIR' => sys_get_temp_dir(),
        ),
    ),
));
Gabriel-Hen commented 1 year ago

Now the error changed for: "QStandardPaths: runtime directory '/tmp' is not owned by UID 33, but a directory permissions 0777 owned by UID 0 GID 0Error: This version of wkhtmltopdf is built against an unpatched version of QT, and does not support more than one input document.Exit with code 1, due to unknown error."

Gabriel-Hen commented 1 year ago

I re-installed wkhtmltopdf by following this and it worked: image

Link: https://stackoverflow.com/questions/34479040/how-to-install-wkhtmltopdf-with-patched-qt

Thank's