Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Chrome Pdf Bundle Laravel Package

daif/chrome-pdf-bundle

View on GitHub
Deep Wiki
Context7

UrlPdfBuilder

Generate a PDF from a URL.

Basic usage

From a URL

namespace App\Controller;

use Daif\ChromePdfBundle\ChromePdfInterface;

class YourController
{
    public function yourControllerMethod(ChromePdfInterface $chromePdf): Response
    {
        return $chromePdf->url()
            ->url('https://example.com')
            ->generate()
            ->stream()
         ;
    }
}

From a Symfony route

namespace App\Controller;

use Daif\ChromePdfBundle\ChromePdfInterface;

class YourController
{
    public function yourControllerMethod(ChromePdfInterface $chromePdf): Response
    {
        return $chromePdf->url()
            ->route('home', [
                'my_var' => 'value'
            ])
            ->generate()
            ->stream()
        ;
    }
}

Available methods

All methods from HtmlPdfBuilder are available, plus:

Method Description
url(string $url) URL of the page to convert
route(string $name, array $parameters) Symfony route to convert

Examples

PDF from external URL with cookies

$chromePdf->url()
    ->url('https://example.com/dashboard')
    ->cookies([
        ['name' => 'session', 'value' => 'abc123', 'domain' => 'example.com'],
    ])
    ->generate()
    ->stream()
;

PDF from internal route with custom headers

$chromePdf->url()
    ->route('report_page', ['id' => 42])
    ->extraHttpHeaders(['Authorization' => 'Bearer token'])
    ->paperStandardSize(PaperSize::A4)
    ->landscape()
    ->generate()
    ->stream()
;
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui