Open RTSchriner opened 4 years ago
I have the same problem, I loading a view with some vuejs components and nothing is loaded.
return PDF::loadView('resultat-print', ['id' => $id]) ->waitUntilNetworkIdle() ->ignoreHttpsErrors() ->noSandbox() ->setDelay(5000) ->inline();
@benlbrm: I had to switch to Puphpeteer (https://github.com/rialto-php/puphpeteer).
@RTSchriner it works for me with the following flow
Build your Vue view for production. Let's say you built it in pdf.min.js
.
In Laravel create view with HTML header and footer. Inside in <script src="">
include your pre-built pdf.min.js
.
$view = View::make('pdf');
Then you do the following:
return PDF::loadHtml($view->render())
->format('A4')
->showBrowserHeaderAndFooter()
->hideHeader()
->footerHtml(View::make('pdf/footer')->render())
->margins(10, 10, 30, 10)
->download(sprintf(
'my.pdf',
));
It will spin a node instance which will run your rendered HTML template in the browser.
As you have in the template pdf.min.js
included, which is a built Vue view/app, the browser will render it and then you get your PDF with Vue rendered.
I think it is also possible to use PDF::loadUrl('http://some') instead and run your Vue view/app somewhere on the server secure from the public access.
I can't get my Vue pages to load correctly with this package. Any help would be greatly appreciated, thanks!