Search code examples
laravel-5laravel-5.4wkhtmltopdfphp-5.6

How to solve Laravel Snappy PDF printing a gibberish string


I'm using Laravel Snappy to print POST data to PDF.

When I try to print PDF, it shows a strange preview like this.

enter image description here

How can I solve this?

Here is my history.

composer require barryvdh/laravel-snappy
composer require h4cc/wkhtmltopdf-amd64
composer require h4cc/wkhtmltoimage-amd64
php artisan vendor:publish --provider="Barryvdh\Snappy\ServiceProvider"
yum install wkhtmltopdf

<?php

namespace App\Http\Controllers\Tests;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

Controller

class TestsController extends Controller
{
    public function download()
    {
        $pdf = \PDF::loadHTML('test');
        $pdf -> setOption('encoding', 'utf-8');
        return $pdf->inline();
    }
}

Solution

  • I solved this. I have not been install any fonts yet my develop environments.

    Here is my solved history.

    yum install ipa-gothic-fonts ipa-mincho-fonts ipa-pgothic-fonts ipa-pmincho-fonts