简体   繁体   中英

how to download a PDF file that is in base64, controller and view en php laravel

I have the PDF stored in the database with base64, but I don't know how to download that file with a button in the view

<li>
  <body>
    <embed style="height: 100%; width: 100%;" src="chunk_split(data:application/pdf;base64,{{$item->PDF}})" type="application/pdf"></object>
  </body>
</li>

<li>
  <body>
    <embed style="height: 100%; width: 100%;" src="chunk_split(data:application/pdf;base64,{{$item->PDF}})" type="application/pdf"></object>
  </body>
</li>

You could create an endpoint to stream the pdf to client like these stream a pdf file .

Then you can create an

<a href="/endpoint/to/download">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM