barryvdh/laravel-dompdf:- fopen 无法打开流:laravel 5.7 中没有这样的文件或目录

Mus*_*aon 3 invoice dompdf laravel

当我想下载 invoice.pdf 时出现错误:-

fopen(project_path\storage\fonts/\071ddd89a9cb147bf5639344caee3fe8.ufm):无法打开流:没有这样的文件或目录

在此处输入图片说明

在存储下创建字体文件夹后也出现错误:

“执行时间到”最大执行时间为 30 秒。

在此处输入图片说明

我现在该怎么办?

小智 14

我有同样的字体问题,我通过这样做解决了它:

$pdf = PDF::loadView('reports.today', ['Data' => $Data])->setOptions(['defaultFont' => 'sans-serif']);


return $pdf->download('invoice.pdf');
Run Code Online (Sandbox Code Playgroud)


小智 7

通过在存储目录中创建一个字体文件夹来修复它


Mus*_*aon 3

经过一路测试,我得到了“fopen失败”和“执行时间已过期”的完美解决方案。

当您使用发票代码扩展主文件时会发生这种情况,例如

@extends('admin.master')
@section('body')
/* your invoice code*/
@sectionend
Run Code Online (Sandbox Code Playgroud)

为了避免所有问题,只需将发票的源代码粘贴到下载发票刀片中,例如

<!doctype html>

    <html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta name="viewport"
              content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>BigStore: Shopping Invoice</title>
    </head>
    <body>


    <style>
    /*css*/
    </style>
    <br>
    /**html code**/
     </body>
    </html>
Run Code Online (Sandbox Code Playgroud)