0

when I try to load my file it loads only file URL what is the solution I try this but it loads only file path in pdf file

return PDF::loadFile(public_path().'/your_html.html')->stream('download.pdf');
brombeer
  • 8,716
  • 5
  • 21
  • 27
Zain Jon
  • 11
  • 3

1 Answers1

0

Your file is in HTML format and also your path indicates it's outside the resources folder, you have to add your HTML file in blade format in resources folder.

loadView function first render the view and then pass it to loadHTML function.

DomPDF https://github.com/barryvdh/laravel-dompdf/blob/00443b33aff68f9e996de536c8f62735c4042131/src/PDF.php

    public function loadView(string $view, array $data = [], array $mergeData = [], ?string $encoding = null): self
    {
        $html = $this->view->make($view, $data, $mergeData)->render();
        return $this->loadHTML($html, $encoding);
    }

And if you want to load html file not in blade format from resource folder so you can checkout how to include html extension file.

Laravel Blade @include .html files

Kamran Allana
  • 543
  • 1
  • 6
  • 25