You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
Hi i am exporting html to pdf with mpdf and have some difficulties with your debug toolbar.
The problem is, on my development PC i have the toolbar enabled in the config.
Now if i export to e.g. pdf i disable all log routes and do my rendering and export to pdf.
foreach (Yii::app()->log->routes as $route)
{
if ($route instanceof CWebLogRoute)
$route->enabled = false;
if ($route instanceof YiiDebugToolbarRoute)
$route->enabled = false;
}
In the generated html code of my views i then still see the import of the js and css files even if the toolbar isn't rendered at all.
And somehow the mPDF has problems with the additional css code :(
Therefore i think the code should be extended that the assets are only registered when at least one toobar is "enabled".
e.g. set a variable to true when one toolbar is enabled
private function registerClientScripts()
{
if($this->owner->enabled)
{
... // register css and js files
}
}
Then the export is working again. I also dont want to request files which arent used at all (e.g. when toolbar is enabled for only a specific ip)
regards Horizons
The text was updated successfully, but these errors were encountered:
Hmm seems not to solve my problem :(
The problem is that if I disable the toolbar "during" the rendering / controller code the css and js code is already imported because the init of the toolbar already happened.
It would be nice if the files are only imported when the toolbar is displayed (actually printed out) and are not registered when the route is disabled during the code.
Edit found a solution:
a simple media setting for the registered css file and my exported pdf is rendered as expected.
Hi i am exporting html to pdf with mpdf and have some difficulties with your debug toolbar.
The problem is, on my development PC i have the toolbar enabled in the config.
Now if i export to e.g. pdf i disable all log routes and do my rendering and export to pdf.
foreach (Yii::app()->log->routes as $route)
{
if ($route instanceof CWebLogRoute)
$route->enabled = false;
if ($route instanceof YiiDebugToolbarRoute)
$route->enabled = false;
}
In the generated html code of my views i then still see the import of the js and css files even if the toolbar isn't rendered at all.
And somehow the mPDF has problems with the additional css code :(
Therefore i think the code should be extended that the assets are only registered when at least one toobar is "enabled".
e.g. set a variable to true when one toolbar is enabled
private function registerClientScripts()
{
if($this->owner->enabled)
{
... // register css and js files
}
}
Then the export is working again. I also dont want to request files which arent used at all (e.g. when toolbar is enabled for only a specific ip)
regards Horizons
The text was updated successfully, but these errors were encountered: