pdf-l4 icon indicating copy to clipboard operation
pdf-l4 copied to clipboard

Crete PDF from HTML

Open jpilldev opened this issue 10 years ago • 2 comments

Hi.

I have a list of users, and i can access to the information details in a web page, i need to generate the pdf file of the information details, so, how can i generate the pdf from the web page?

I already have the page with the style and the information i need

The route is:

Route::get('myusers/{id?}', 'UsersController@showUser');

jpilldev avatar Aug 28 '14 23:08 jpilldev

Hi.

You can try this :

Route::get('pdf-from-view', function()
{
    $data = array();
    $html = View::make('my-view', $data);
    return PDF::load($html, 'A4', 'portrait')->show();
});

thujohn avatar Aug 31 '14 20:08 thujohn

Thanks for answer. I build the data array with the id of the user Route::get('myusers/{id?}', function(){ $data = array('as' => 'data, 'uses' => 'UsersController@showUser'); $html = View::make('myusers/{id?}', $data); return PDF::load($html, 'A4', 'portrait')->show; }); All i got is an exception that the route 'myusers' doesn't exist

jpilldev avatar Sep 02 '14 02:09 jpilldev