自分の開発しているLaravelを用いたシステムで、laravel-snappyとwkhtmltopdfを使ってPDFを出力する処理があるのですが、wkhtmltopdfを0.12.6-1にバージョンアップしたところ下記のようなエラーが表示されるようになりました。
The exit status code '1' says something went wrong: stderr: "Loading pages (1/6) [> ] 0% [======> ] 10% Warning: Blocked access to file [============================> ] 48% Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown Warning: Blocked access to file /var/www/storage/fonts/ipag.ttf Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
どうもローカルのフォントファイルを読み込もうとしてエラーが発生している模様。調べてみると、wkhtmltopdfへのオプションに「–enable-local-file-access」というものを追加すればよい模様。
そこで、config/snappy.phpのoptionsのところを次のように修正しました。
'pdf' => array( 'enabled' => true, 'binary' => '/usr/local/bin/wkhtmltopdf', 'timeout' => 3600, 'options' => array('enable-local-file-access' => true), 'env' => array(), ),
これで再び出力を試みたところ正常にPDFが出力されるようになりました。