I'm changing server and I'm in the process of migrating the content, using a cloned copy. I'm checking that everything works.
But the generation of a pdf using wkhtmltopdf and the snappy wrapper does not work. It seems to create a pdf, but when trying to open it says:
Unable to open document "file:///home/rosamunda/Desktop/file.pdf". File type plain text document (text/plain) is not supported.
Here's the file in question:
error_reporting();
ini_set('display_errors', 1);
require $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php';
use Knp\Snappy\Pdf;
$snappy = new Pdf('/usr/bin/wkhtmltopdf');
$snappy->setBinary('/usr/bin/wkhtmltopdf');
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="file.pdf"');
echo $snappy->getOutput('http://www.github.com');
The page is completely blank, no errors in the error log.
PHP version: PHP-FPM 8.2.17 (remi-safe).
OpenSSL version: 1.1.1k FIPS 25 Mar 2021
Multibyte decoding support using mbstring: Enabled
Any insight is greatly appreaciated!