{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/browsershot/issues/159","repository_url":"https://api.github.com/repos/spatie/browsershot","labels_url":"https://api.github.com/repos/spatie/browsershot/issues/159/labels{/name}","comments_url":"https://api.github.com/repos/spatie/browsershot/issues/159/comments","events_url":"https://api.github.com/repos/spatie/browsershot/issues/159/events","html_url":"https://github.com/spatie/browsershot/issues/159","id":297764364,"number":159,"title":"Is it possible to pass a Laravel view to the HTML method?","user":{"login":"lmartins","id":151981,"avatar_url":"https://avatars2.githubusercontent.com/u/151981?v=4","gravatar_id":"","url":"https://api.github.com/users/lmartins","html_url":"https://github.com/lmartins","followers_url":"https://api.github.com/users/lmartins/followers","following_url":"https://api.github.com/users/lmartins/following{/other_user}","gists_url":"https://api.github.com/users/lmartins/gists{/gist_id}","starred_url":"https://api.github.com/users/lmartins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmartins/subscriptions","organizations_url":"https://api.github.com/users/lmartins/orgs","repos_url":"https://api.github.com/users/lmartins/repos","events_url":"https://api.github.com/users/lmartins/events{/privacy}","received_events_url":"https://api.github.com/users/lmartins/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-16T12:06:43Z","updated_at":"2018-02-16T19:16:47Z","closed_at":"2018-02-16T15:01:59Z","author_association":"NONE","body":"Hi,\r\n\r\nI'm using this library alongside with Laravel and was wondering if it would be possible to pass a view directly into the `html` method and have that generate the file, something along these lines:\r\n\r\n```php\r\n        $temporaryDirectory = (new TemporaryDirectory())->create();\r\n        $pdfPath = $temporaryDirectory->path( $organization->name . '.pdf');\r\n\r\n        Browsershot::html( view('organizations.report', compact('organization', 'results', 'purchases')) )\r\n            ->showBackground()\r\n            ->margins(0, 0, 0, 0)\r\n            ->paperSize(216, 280)\r\n            ->savePdf($pdfPath);\r\n\r\n        return( $pdfPath );\r\n```\r\nIs this possible? \r\nThe code above does generate a PDF, however all the images are missing so I wonder is this is something that is supported.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/spatie/browsershot/issues/comments/366332130","html_url":"https://github.com/spatie/browsershot/issues/159#issuecomment-366332130","issue_url":"https://api.github.com/repos/spatie/browsershot/issues/159","id":366332130,"user":{"login":"lmartins","id":151981,"avatar_url":"https://avatars2.githubusercontent.com/u/151981?v=4","gravatar_id":"","url":"https://api.github.com/users/lmartins","html_url":"https://github.com/lmartins","followers_url":"https://api.github.com/users/lmartins/followers","following_url":"https://api.github.com/users/lmartins/following{/other_user}","gists_url":"https://api.github.com/users/lmartins/gists{/gist_id}","starred_url":"https://api.github.com/users/lmartins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmartins/subscriptions","organizations_url":"https://api.github.com/users/lmartins/orgs","repos_url":"https://api.github.com/users/lmartins/repos","events_url":"https://api.github.com/users/lmartins/events{/privacy}","received_events_url":"https://api.github.com/users/lmartins/received_events","type":"User","site_admin":false},"created_at":"2018-02-16T19:16:47Z","updated_at":"2018-02-16T19:16:47Z","author_association":"NONE","body":"@freekmurze thanks for your feedback. \r\nI've tried that, by rendering the view into a variable:\r\n\r\n```php\r\n$html = \\View::make('organizations.report', compact('organization'))->render();\r\n```\r\n\r\nand then pass it to Browsershot:\r\n\r\n```php\r\n$file = Browsershot::html( $html )\r\n            ->showBackground()\r\n            ->margins(0, 0, 0, 0)\r\n            ->paperSize(216, 280)\r\n            ->save($pdfPath);\r\n```\r\nProblem is images still no load on the PDF, while if I simply return the variable with the view described above I get right html, including images.\r\n\r\nAny tips here please?"}}
{"actor":{"display_login":"lmartins"}}