# |
Oct 9th 2016, 13:40 |
ndm |
@waspinator The `Html` helper should be included by default... that aside you'd either use `CakePDF::helpers()` as you've shown it, or specify a custom view class where you can load helpers. Also the core view does autoloading of helpers on the fly based on their names in case they haven't been explicitly loaded. |
# |
Oct 9th 2016, 13:39 |
maikh |
oh... i thin it works now |
# |
Oct 9th 2016, 13:35 |
waspinator |
I would just try on your local dev environment. if it works, then you know its something with Dompdf. If it doesn't then it's probably something else |
# |
Oct 9th 2016, 13:34 |
maikh |
i tried is with all other supported pdfs generators. nothing. |
# |
Oct 9th 2016, 13:34 |
maikh |
i dont want to use wkhtmltopdf beacause i dont can use this binary |
# |
Oct 9th 2016, 13:34 |
waspinator |
can you try to change PDF renderers to test? |
# |
Oct 9th 2016, 13:33 |
waspinator |
@maikh I'm using WKHTMLTOPDF, maybe that plays a part |
# |
Oct 9th 2016, 13:32 |
maikh |
hm... thats very ugly... i tried it like @waspinator said... nothing. |
# |
Oct 9th 2016, 13:32 |
ndm |
@maikh If it works there, and the CSS content is Dompdf compatible, then I'm afraid that I'm pretty much out of ideas at this point. Maybe your server responds to the CSS file request in a ways that Dompdf doesn't like, I really don't know... |
# |
Oct 9th 2016, 13:31 |
waspinator |
for example `link rel="stylesheet" type="text/css" href="<?=WWW_ROOT . 'css' . DS . 'bootstrap' . DS . 'bootstrap.css'?>"` |
# |
Oct 9th 2016, 13:30 |
waspinator |
without any cake helpers |
# |
Oct 9th 2016, 13:30 |
waspinator |
I'm currently just making the links myself. and that works |
# |
Oct 9th 2016, 13:29 |
waspinator |
on a related topic, I'm having trouble calling view helpers when generating pdfs from a shell. any ideas of how to enable those? `$CakePdf->helpers(['Html']);` doesn't work, and it looks like others have had the question as well. https://github.com/FriendsOfCake/CakePdf/issues/63 |
# |
Oct 9th 2016, 13:28 |
maikh |
@ndm yes, in tryitEditor |
# |
Oct 9th 2016, 13:27 |
ndm |
Debugging the return value ` $CakePdf->html()` should have been enough ;) Again, have you tried that HTML in your browser? |
# |
Oct 9th 2016, 13:24 |
maikh |
the html begins at line 1815 |
# |
Oct 9th 2016, 13:23 |
ndm |
That's what she said... |
# |
Oct 9th 2016, 13:23 |
maikh |
@ndm its huge :slightly_smiling_face: http://pastebin.com/UEGSSckX |
# |
Oct 9th 2016, 13:22 |
maikh |
there is many many content in this. i will paste it. |
# |
Oct 9th 2016, 13:22 |
ndm |
Also have you tried to let the browser render the HTML in order to check whether it's being displayed as expected? ie whether your external file can be loaded properly. |
# |
Oct 9th 2016, 13:21 |
ndm |
And "correct" looks like what exactly? |
# |
Oct 9th 2016, 13:15 |
maikh |
ok, so i did a debug in CakePdf::html() the output is my correct html with the correct rel tags. |
# |
Oct 9th 2016, 13:14 |
ndm |
Eh, my bad... `PdfView` is only involed when actions are being rendered. |
# |
Oct 9th 2016, 13:13 |
maikh |
hm, a debug on that did nothing. It dont jumps into the render method i think. |
# |
Oct 9th 2016, 13:08 |
ndm |
Despite the fact that you don't need to call `output()` if you don't use the return value, the snippet works for me too. Guess you gotta do some more debugging, there isn't much I could do from here other than shooting into the dark... start by inspecting whether the expected HTML is being generated (check `$content` in `PdfView::render()`). |
# |
Oct 9th 2016, 13:02 |
maikh |
and this is how i implement the pdf generation: http://pastebin.com/JYSnJjwi |
# |
Oct 9th 2016, 12:59 |
maikh |
if i set this directly in style></style than this works fine. |
# |
Oct 9th 2016, 12:59 |
maikh |
i only set a background-color for .container class. |
# |
Oct 9th 2016, 12:58 |
ndm |
How do you test that the file isn't being loaded? Does the CSS file contain styles that Dompdf can actually handle? |
# |
Oct 9th 2016, 12:57 |
maikh |
hm... |
# |
Oct 9th 2016, 12:57 |
ndm |
That should work fine... it does for me at least. |
# |
Oct 9th 2016, 12:55 |
maikh |
http://pastebin.com/my6vdhcs |
# |
Oct 9th 2016, 12:54 |
maikh |
yes, it is. |
# |
Oct 9th 2016, 12:54 |
ndm |
also it should be inside `head` |
# |
Oct 9th 2016, 12:54 |
maikh |
nothing only with pdf. have i to do something in my controller before that? |
# |
Oct 9th 2016, 12:53 |
ndm |
the path should be either non-relative, ie `/css/pdf.css`, or the shorthand variant, just `pdf` |
# |
Oct 9th 2016, 12:53 |
maikh |
i tried is withou the leading "css" but it also not work |
# |
Oct 9th 2016, 12:52 |
maikh |
@ndm in doku it is so: ```echo $this->Html->css('bootstrap/bootstrap.css', ['fullBase' => true]);``` |
# |
Oct 9th 2016, 12:51 |
maikh |
this file is in webroot/css/pdf.css |
# |
Oct 9th 2016, 12:50 |
maikh |
@ndm this is in my template in ```head></head>``` ```<?= $this->Html->css('css/pdf.css', ['fullBase' => true]); ?``` |
# |
Oct 9th 2016, 12:50 |
ndm |
So, _where_ and _how_ are you including it? |