Comments (8)
I'm not sure if that issue is still relevant, but I ran into a similar one with Laravel's url helper.
After a bit of debugging I've realised that the urls included in my HTML were not the same whether I was generating the PDF file from the site itself or a queue (CLI)
- Through the site: http://myTestApp.app
- Through CLI: http://localhost
http://localhost doesn't return anything in my environment hence the issue.
In order to get it working correctly, I just had to modify the url settings in my app's config/app.php. That simple...
Btw, thanks for your wonderful work Barry!
from laravel-snappy.
Needs to be an absolute path and not a relative path for CSS and javascript includes. I ran into this last night.
So the css and javascript paths need to be "http://mysite.dev:8000/css/app.css". For whatever reason wkhtmltopdf executable doesn't seem to resolve those assets as being relative to the page. After I changed my pdf template to use absolute urls, the problem resolved it self for me.
from laravel-snappy.
Homestead solution for me.
- Edit hots file in homestead
sudo nano /etc/hosts
- Add domain app
laravel.local
127.0.0.1 laravel.local
- Link asset with
asset
function
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
from laravel-snappy.
I'm using Laravel 5.7 with Homestead on Windows 10
So I had a proyect on Laravel 4.2 where I was able to include the CSS files like this
<link rel="stylesheet" href="{{public_path().'/css/all.css'}}">
Now on this new proyect using the same logic is giving me an error, so I use @dereckmartin solution and it worked for my. So I include the CSS files like this
<link rel="stylesheet" href="http://test.localhost:8000/public/css/all.css">
but I want to know why I can't use the public path anymore, I don't like to leave it like this because we are several people on the proyect so they need to change the url everytime they want to see a pdf
from laravel-snappy.
So you are using Nginx right, not the built-in server?
from laravel-snappy.
Correct, using nginx from the vm, not the php built-in server. For now I've done the workaround of grabbing the contents of that file and putting them into style tags. Not ideal but it seems to work. I could make an example app later on and reproduce the issue if that would help?
from laravel-snappy.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/KnpLabs/snappy instead. When having doubts, please try to reproduce the issue with just snappy.
If you believe this is an actual issue with the latest version of laravel-snappy, please reply to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.
from laravel-snappy.
I am using laravel snappy.It is correctly working in my local machine, but when deployed in production it is not working, any help
from laravel-snappy.
Related Issues (20)
- Footer not showing in the large files
- How can I get my wkhtmltopdf footer to display on all pages in my Laravel project with barryvdh package?
- DPI 300 footer/header issues HOT 1
- footer-html not loading JavaScript
- How to get total page outside the header and footer ? HOT 1
- Bug - The output file scheme is not supported. HOT 8
- How to generate PDF file full size HOT 1
- barryvdh / laravel-snappy not working on production HOT 1
- Incorrect File Name Encoding on Safari When Downloading PDF with Non-ASCII Characters
- Load external font HOT 2
- intall in FREEBSD fail
- /usr/local/bin/wkhtmltopdf not found
- The exit status code '1' says something went wrong: stderr: "Fontconfig error: No writable cache directories HOT 2
- Mac & Composer Install - The exit status code '127' says something went wrong: stderr: HOT 2
- Download & Stream Not Working After Adding Dynamic Variables HOT 1
- bad result when generate pdf with laravel queue
- Vulnerability a'la Snyk HOT 1
- The process has been signaled with signal "11". HOT 2
- Textarea value is not displaying when enable-forms is true
- How to automatically fill remaining spaces of pdf file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-snappy.