php - Laravel download view as pdf with images
Get the solution ↓↓↓I am using barryvdh/laravel-dompdf package to download view as a pdf. In the page I have put some images with internal links. Internal links are protected with auth and some other middleware. When I see the view all images are there, but after downloading the pdf, images are not being loaded (Shows message: Image not found or type unknown) due to auth middleware.
What can be the alternative ways to download pdf with images.
I can't remove middleware from the image url.
Answer
Solution:
This is what I did, I fetched the images in the controller itself and then converted the images as base64 image. And then passed to the view. Now everything is working fine.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: constant expression contains invalid operations
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.