Giter Site home page Giter Site logo

Comments (8)

benheu avatar benheu commented on July 20, 2024 3

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)

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.

dereckmartin avatar dereckmartin commented on July 20, 2024 2

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.

set0x avatar set0x commented on July 20, 2024 2

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.

godhandkiller avatar godhandkiller commented on July 20, 2024 1

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.

barryvdh avatar barryvdh commented on July 20, 2024

So you are using Nginx right, not the built-in server?

from laravel-snappy.

austenc avatar austenc commented on July 20, 2024

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.

stale avatar stale commented on July 20, 2024

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.

igprogrammer avatar igprogrammer commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.