Support the ongoing development of Laravel.io →
Input Views Blade
Last updated 2 years ago.
0

PDF generation is a view. You should return it in appropriate controller.

Last updated 2 years ago.
0

Thanks for answer:

I have something like this:

Route::get('myusers/{id?}', function($id){
    $data =  array('as' => 'id', 'uses' 
        => 'UserController@showUser');
    $html = View::make('myusers')->with('target', $id);
    return PDF::load($html, 'A4', 'portrait')->show;
});

That doesn't work, i feel confused on how i can user that.

Thanks.

Last updated 2 years ago.
0

You need to render first the html:

$html = View::make('myusers')->with('target', $id)->render();

Than you can pass the view to your PDF class.

If you have any further questions you can ask me, I am using also this package. It works great for me.

Do you get any errors?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jpilldev jpilldev Joined 28 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.