Generate PDF from HTML Using Laravel Snappy Package

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 65

  • @QiroLab
    @QiroLab  4 года назад +3

    Generate PDFs in Laravel with Spatie/Browsershot
    ruclips.net/video/320vwRDqi9w/видео.html
    Support my work:
    1. On BuyMeACoffee: www.buymeacoffee.com/qirolab
    2. On Patreon: www.patreon.com/qirolab
    Timestamps:
    00:49 Wkhtmltopdf Installation
    3:26 Install and configure Laravel Snappy Package
    5:10 Usage of Laravel Snappy package
    9:06 Generate PDF from Blade file
    10:02 CSS styling for PDF export
    10:48 Page break (Add pages to PDF file)
    11:38 Layout and Partials for PDF export
    13:30 Set Options for PDF file in Laravel Snappy
    16:33 Set Header and Footer for PDF
    20:36 Testing feature (PDF fake)
    23:10 (Method 1) Send dynamic generated PDF in the email
    26:56 (Method 2) Send dynamic generated PDF in the email

  • @lucianobalbiano3074
    @lucianobalbiano3074 Год назад

    I have a view with js and dynamic components, when i press the button to print the pdf, the server gets stuck loading, should i implement different logic when i have this type of components?

    • @QiroLab
      @QiroLab  9 месяцев назад

      I have seen lots of developers are facing many issues on Snappy package. I recommend you to try out Spatie/BrowserShot packages. Here is the tutorial video on this:
      ruclips.net/video/320vwRDqi9w/видео.html

  • @abanahmed4683
    @abanahmed4683 4 года назад +2

    Hi i face problem when i want to add tag, I have some image in storage in public but the pdf do not show it while the src correct i try it on browser and it work and i try url() and asset() to bring image but no thing work , also when i add img tag it take too long time to download while I am using xampp locally

    • @evaristopaulo7211
      @evaristopaulo7211 4 года назад +2

      I'm facing the same problem, bruh.
      Everything works fine when accessing the image in another route, but when I try to do the same with pdf' route, the image doesn't display.

    • @miratorimoonlight7738
      @miratorimoonlight7738 3 года назад +2

      One of the causes is that wkhtmltopdf cannot access your local files.
      So the solution for that is:
      - Go to config/snappy.php
      - In the options part, write this: 'options' => ["enable-local-file-access" => true]
      reference: stackoverflow.com/questions/62315246/wkhtmltopdf-0-12-6-warning-blocked-access-to-file

  • @adamfiqrie8350
    @adamfiqrie8350 3 года назад

    hi...got a problem....i try to render my js chart but my chart does not appear in pdf..any idea??

  • @pathros425
    @pathros425 4 года назад

    3:20 Thanks! I can confirm I could successfully install "wkhtmltopdf" on Laravel Homestead with vagrant 2.2.7 and VirtualBox 6.1 by using Composer. What I additionally had to do was to copy the file to the bin/ directory, make it executable and reboot the VM of Laravel Homestead. What it made me think is the fact that in my case, the version installed was 0.12.4 (and not the 0.12.5 like in your case).

  • @JuniorCh4p0liN
    @JuniorCh4p0liN 3 года назад +3

    I've tried with several versions of laravel-snappy and wkhtmltopdf insert image in pdf just like you did in the example with the link placekitten.com/130/130. It gives error and the pdf is not generated. Could you help me with that pfv.

    • @yologonzalez7365
      @yologonzalez7365 3 года назад +2

      i have the same issue

    • @briyandana2495
      @briyandana2495 3 года назад +1

      i have the same issue too, i've tried insert image in pdf

  • @webturtlesvlog
    @webturtlesvlog 4 года назад +1

    The dompdf seems easy in compare to this package "barryvdh/laravel-dompdf".
    Is there any any difference that you could figure out between this two packages?

    • @rutgerburger3385
      @rutgerburger3385 4 года назад +1

      If you have a complex report of otherwise lengthy output, dompdf runs out of memory. I just paid a hefty price for use that package.Rebuilding everything in snappy now and works fine up until now.

    • @richnieh
      @richnieh 3 года назад +1

      If you have a large table that is over a page, I personally cannot break the table using dompdf also if the table is mapped to a database and the amount of data varies, that table sizes maybe dynamic so even if you force the page break, it might not break properly in the next instance. Snappy break the table automatically for you.

  • @shrigamingplay2056
    @shrigamingplay2056 3 года назад

    How we can install it on Live server , I am getting problem on live server

  • @alexandermashamba6132
    @alexandermashamba6132 3 года назад +1

    Thank you so much, the video is fantastic

    • @QiroLab
      @QiroLab  3 года назад

      Glad you liked it!

  • @SonickTutoriales
    @SonickTutoriales 4 года назад

    It is possible to have in the same project DomPDF and laravel snappy.
    Since there is pdf implemented with DomPDF.
    And I need to add some with graphics and I want to use laravel snappy, but without affecting the existing ones it is possible.?
    ---
    Es posible tener en el mismo proyecto DomPDF y laravel snappy.
    Dado que hay pdf implementado con DomPDF.
    Y necesito añadir unos con gráficas y quiero usar laravel snappy, pero sin afectar a los existentes es posible.?

  • @rajeshkumargoit4937
    @rajeshkumargoit4937 3 года назад

    Hi Sir can we develop devanagari pdf report in laravel ?

  • @alshojamikbal8510
    @alshojamikbal8510 Год назад

    Great Man

    • @QiroLab
      @QiroLab  9 месяцев назад

      I have seen lots of developers are facing many issues on Snappy package. I recommend you to try out Spatie/BrowserShot packages. Here is the tutorial video on this:
      ruclips.net/video/320vwRDqi9w/видео.html

  • @valdirjunior
    @valdirjunior 4 года назад

    hi,
    would have an example to make a table of contents (toc)?

  • @MauroTelloDesarrollos
    @MauroTelloDesarrollos 3 года назад +1

    Hi, I have tried various ways but it does not show me the images. Can someone give me an example of how to display an image in html? I put it with asset ('img / foto.jpg')

  • @kris280able
    @kris280able 3 года назад

    Thnk you so much for the tutorial. I was using dompdf but the style was just broke. I will update if this is working.

  • @nicolaschavez8841
    @nicolaschavez8841 3 года назад

    i cant set page numbers in html q_q scripts dowsnt works

  • @khaldounnd1261
    @khaldounnd1261 Год назад

    Great tutorial thank you

    • @QiroLab
      @QiroLab  9 месяцев назад

      Thank you

  • @avthreek
    @avthreek 4 года назад

    Great resource, thanks!

  • @yankotinujonnata5036
    @yankotinujonnata5036 3 года назад

    It's a great tutorial and very easy to learn, but i have a problem. When i try the code in 19:07, it gives a error with given message "The exit status code '-1073741819' says something went wrong". Is there any solution for this problem?

  • @programming_tips_bd
    @programming_tips_bd Год назад

    Excellent , will it work for 2000 pages of PDF ?

    • @QiroLab
      @QiroLab  9 месяцев назад

      It will work, and keep in mind, more pages means more resource (eg CPU, RAM) usage.
      I have seen lots of developers are facing many issues on Snappy package. I recommend you to try out Spatie/BrowserShot packages. Here is the tutorial video on this: ruclips.net/video/320vwRDqi9w/видео.html

  • @hasnaakhalf6462
    @hasnaakhalf6462 4 года назад

    i follow this but have a problem
    Call to undefined method niklasravnsborg\LaravelPdf\Pdf::setOption()
    any help ?

    • @QiroLab
      @QiroLab  4 года назад

      You are using wrong namespace, use this "\Pdf::setOption()"

  • @ranialamtabti8475
    @ranialamtabti8475 4 года назад +1

    thank you so match, that's exactly what I neede

  • @mohammadadnan7151
    @mohammadadnan7151 2 года назад

    how can i remove margin right in footer

  • @MarcoPolo-bh6yy
    @MarcoPolo-bh6yy 2 месяца назад

    how can i make the content extend to footer?

    • @QiroLab
      @QiroLab  9 дней назад

      To make the content extend to the footer, please watch from the 16:33 mark of this video. Also, I recommend trying the Spatie/Browsershot package instead of the Laravel Snappy package. I've already created a video on Spatie/Browsershot, which you can check out here: ruclips.net/video/320vwRDqi9w/видео.html.

  • @prasannadhanapala425
    @prasannadhanapala425 3 года назад

    How to install the binary files on a live server

  • @AnandSingh-jo6gf
    @AnandSingh-jo6gf 2 года назад

    How to resolve font uneven letter spacing issue?

    • @QiroLab
      @QiroLab  9 месяцев назад

      I have seen lots of developers are facing many issues on Snappy package. I recommend you to try out Spatie/BrowserShot packages. Here is the tutorial video on this: ruclips.net/video/320vwRDqi9w/видео.html

  • @ranialamtabti8475
    @ranialamtabti8475 4 года назад

    hi I had a problem, I could't download it for windows

  • @nicolaschavez8841
    @nicolaschavez8841 3 года назад

    how load public images to the view

    • @nicolaschavez8841
      @nicolaschavez8841 3 года назад +1

      i found it , use public_path($path) instead asset or url

  • @theviz02webdev2
    @theviz02webdev2 2 года назад

    Image is not working

  • @fayzasalman6739
    @fayzasalman6739 3 года назад

    It helps me alot thanks

    • @QiroLab
      @QiroLab  3 года назад +1

      Glad it was helpful!

  • @abdulshamadhu9886
    @abdulshamadhu9886 3 года назад

    how about PASSWORD setup?

  • @nicolaschavez8841
    @nicolaschavez8841 3 года назад

    footer and header are not rendering q_q

    • @nicolaschavez8841
      @nicolaschavez8841 3 года назад

      ok... only set margins in snappy.php or options

    • @kaidoauxcentbetes
      @kaidoauxcentbetes 3 года назад

      @@nicolaschavez8841 did you find how to display header and footer ?

    • @MarcoPolo-bh6yy
      @MarcoPolo-bh6yy 2 месяца назад

      i have the same problem

  • @AB-yh6hf
    @AB-yh6hf 4 года назад

    Gracias!

  • @gauravamoli9277
    @gauravamoli9277 2 года назад

    Please make laravel multi auth from scratch without any package...please😥😥😥i want to learn it

    • @QiroLab
      @QiroLab  2 года назад

      noted, I will make video on this as well.

    • @gauravamoli9277
      @gauravamoli9277 2 года назад

      @@QiroLab thank you i am waiting for it..😋😋

  • @delvinnj7941
    @delvinnj7941 Год назад

    How to add the Arabic language to this ?

    • @QiroLab
      @QiroLab  9 месяцев назад

      For that you can use Arabic font.
      I have seen lots of developers are facing many issues on Snappy package. I recommend you to try out Spatie/BrowserShot packages. Here is the tutorial video on this: ruclips.net/video/320vwRDqi9w/видео.html

  • @linnhtetaung5923
    @linnhtetaung5923 9 месяцев назад

    The exit status code '1' says something went wrong: stderr: "Loading pages (1/6) [> ] 0% [======> ] 10% Warning: Blocked access to file [=========> ] 16% Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown [============> ] 20% Warning: Blocked access to file Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown [============================================================] 100% Counting pages (2/6) [============================================================] Object 1 of 1 Warning: Received createRequest signal on a disposed ResourceObject's NetworkAccessManager. This might be an indication of an taking too long to load. Resolving links (4/6) [============================================================] Object 1 of 1 Loading headers and footers (5/6) Printing pages (6/6) [> ] Preparing [============================================================] Page 1 of 1 Done Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown Exit with code 1 due to network error: ProtocolUnknownError " stdout: "" command: "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" --lowquality "C:\Users\DELL\AppData\Local\Temp\knp_snappy65937cd73e14f9.48597023.html" "C:\Users\DELL\AppData\Local\Temp\knp_snappy65937cd73e7b03.59955970.pdf".

    • @QiroLab
      @QiroLab  9 месяцев назад

      I have seen lots of developers are facing many issues on Snappy package. I recommend you to try out Spatie/BrowserShot packages. Here is the tutorial video on this:
      ruclips.net/video/320vwRDqi9w/видео.html

  • @mohammadarif9999
    @mohammadarif9999 4 года назад

    how i can use binary on live server

    • @QiroLab
      @QiroLab  4 года назад +2

      Download the binary file according to your live server as shown in the video at 2:05 and install it on your server and then specify the installed binary path in the Laravel config file.