wkhtmltopdf, 0.12.6, Warning: Blocked access to file

前端 未结 5 847
耶瑟儿~
耶瑟儿~ 2020-12-20 11:02

When upgrade wkhtmltopdf to 0.12.6, it came to such messages and the image did not show in the target pdf:

    Warning: Blocked acc         


        
5条回答
  •  抹茶落季
    2020-12-20 11:33

    For those that are using laravel-snappy, add the 'enable-local-file-access' option in the config\snappy.php:

    'pdf' => [
            'enabled' => true,
            'binary'  => env('WKHTML_PDF_BINARY', '/usr/local/bin/wkhtmltopdf'),
            'timeout' => false,
            'options' => [
                'enable-local-file-access' => true,
                'orientation'   => 'landscape',
                'encoding'      => 'UTF-8'
            ],
            'env'     => [],
        ],
    
        'image' => [
            'enabled' => true,
            'binary'  => env('WKHTML_IMG_BINARY', '/usr/local/bin/wkhtmltoimage'),
            'timeout' => false,
            'options' => [
                'enable-local-file-access' => true,
                'orientation'   => 'landscape',
                'encoding'      => 'UTF-8'
            ],
            'env'     => [],
        ],
    

    wkhtmltopdf disables local file access by default in the 0.12.6 version

提交回复
热议问题