Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

873
Views
Laravel: error DOMPDF al intentar obtener PDF

He estado tratando de obtener el PDF de una vista usando DOMPDF con una tabla llena de ingredientes de una tabla de base de datos.

Creé una función en mi controlador:

 public function createPDF() { // retreive all records from db $data = Ingredients::all(); // share data to view view()->share('ingredients', $data); $pdf = PDF::loadView('printableingredientslist', $data); // download PDF file with download method return $pdf->download('printableingredientslist.pdf'); }

Y la ruta en web.php se define como:

 Route::get('/printpreviewingredients/pdf', [MealPlanDisplayController::class, 'createPDF']);

Sin embargo, sigo recibiendo este error:

fopen(D:\mealplan\storage\fonts//nunito_normal_46b9b3b48cc3ddbae60da82f1c1c5d29.ufm): no se pudo abrir la transmisión: no existe tal archivo o directorio

Debe tener algo que ver con la 'lista de printableingredientslist ' como cuando la reemplacé con una plain view page simple con texto simple que funcionó. Sin embargo, estoy luchando por ver cómo hay un problema de ruta, ya que printableingredientslist.blade.php está simplemente en la carpeta de vistas. ¿Cuál puede ser el problema? Estoy usando tailwind.css , ¿podría ser un problema?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

método setOptions para usar la fuente predeterminada. Por ejemplo, como a continuación

 public function pdf() { $pdf = \PDF::loadView('contact')->setOptions(['defaultFont' => 'sans-serif']); return $pdf->download('invoice.pdf'); }

o

Crear las fonts del directorio en el directorio de storage

Referencia: https://github.com/barryvdh/laravel-dompdf/issues/724

Referencia: https://github.com/barryvdh/laravel-dompdf/issues/176

Referencia: https://github.com/barryvdh/laravel-dompdf/issues/269

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!