Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF download freezes entire application #8

Closed
dmarko484 opened this issue Oct 11, 2013 · 3 comments
Closed

PDF download freezes entire application #8

dmarko484 opened this issue Oct 11, 2013 · 3 comments

Comments

@dmarko484
Copy link

I have a quite simple report implemented with latest Laravel 4.0.8 under Apapche on windows (PHP 5.4.x). The first time I click on report link the download works fine. The second time I do it it simply freezes app and ends up with error message as below. I tried to restart apache/php stack but its the same.

The error I get is like this:

Symfony \ Component \ Debug \ Exception \ FatalErrorException

Maximum execution time of 30 seconds exceeded
open: C:\e-projects\laravel\gapps\vendor\symfony\http-foundation\Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy.php

}

/**
* {@inheritdoc}
*/
public function read($id)
{
return (string) $this->handler->read($id);
}

My code is quite simple:

public function getPdfreport(){
$p=Project::find(Input::get("id"));
$c=Company::find($p->company_id);
$m=Milestone::where("project_id",$p->id)->orderBy("status")->with("manager")->get();

$h = View::make("projects::pdf/project_report",$data=array("p"=>$p, "c"=>$c, "mm"=>$m));

$x = PDF::loadHTML($h);
return $x->download($filename="project_".$p->id.".pdf");

}

Any idea what causes such error?

@barryvdh
Copy link
Owner

Is this just for this view or for all pdfs? Does this also happen for simple views? Like just one sentence without a lot of data. And is this everytime, first time it works, then no more?

@dmarko484
Copy link
Author

I found something similar in DOMPDF Faq page.

Q: I'm getting the following error:
Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/dompdf/dompdf.php on line XXX
A: Nested tables are not supported yet and can cause dompdf to enter an endless loop, thus giving rise to this error.

So I experimented with my blade template I use to generate PDF and I found out, that the source of problem is the Twitter Bootstrap CSS. When removed it from html the problem disapeared ... its a different problem than nested tables as mentioned in FAQ, but definitely shows that some kind of html or CSS can cause such kind of problems ...

@barryvdh
Copy link
Owner

Okay, so I guess the problem lies upstream then. I'll close this issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants