I'm using PHPWord in my SF2.8 application, and i would like to use a twig as template for my docx it works but there is no CSS. How can I do to put CSS ?
Thanks a lot !
Related
I'm struggling with svg icons. I'm creating menu and to do this I have to use several of svg icons. I already know, that if I want to manipulate colour with help CSS (for example when icon is active/hover) I have to use in HTML <svg> tag not <img src="path-to-icon.svg"/>.
How can I solve this problem in a nice way?
I don't want use full path of svg in my HTML file, because sometimes it is has a hundred of lines d="..." attribute. I try to avoid use <use xlink:href="path-to-icon.svg" /> as well, because is not supported by IE or Edge browsers.
I can add that I use .twig template, so maybe there is a 'PHP' way to add icon.
HTML:
<label id="menuIcon" for="menu" onclick="openNav()">
{# svg icon #}
</label>
CSS
.icon:hover path {
fill: green;
}
I would generate my own font file with all the icons used in the application... just like fontawesome or ionicons.
Please see this Craft Function within Twig it may be useful:
https://craftcms.com/docs/3.x/dev/functions.html#svg
You can also put your code into a .twig template and include that like you would any other twig file.
I am trying to convert html to pdf using fpdf. But styles are not working with it. Please suggest me how can I use style internally in fpdf.
I use <style> tag for including style.
i designed the invoice using bootstrap css, i used tcpdf to design invoice. I called bootstrap css file but its not working, Kindly help me.. My coding is
$baseurl = "http://localhost/erp";
$html = '<style>'.file_get_contents($baseurl.'css/bootstrap.min.css').'</style>';
$html = '<style>'.file_get_contents($baseurl.'css/style.css').'</style>';
First of all - Bootstrap use js scripts for working; As You understand, scripts could not be working in tcpdf file;
More than that - tcpdf not allowed all CSS attributes; I can't find supported css list in official documentation, but this can help;
I want to use pagenumbering in mpdf with tags how its described in mpdf manual:
http://mpdf1.com/manual/index.php?tid=109
Problem is I have used smarty template engine and there I can not use mpdf tag {PAGENO} in header/footer direct in html template, because I think smarty expected in {} parentheses variables. ( example {$test} )
So when I define {PAGENO}, smarty get syntax error: unrecognized tag 'PAGENO' ...
also I have tried to call this metod, but it's not working->when I generate pdf, in generated pdf is nothing regarding page numbering:
// Set a simple Footer including the page number
$mpdf->setFooter('{PAGENO}');
Have anybody some idea, how I could use mpdf page numbering with smarty template engine?
thx
Just use {literal} in your html template:
{literal}{PAGENO}{/literal}
So I am using the codeigniter pdf library from: https://github.com/chrisnharvey/CodeIgniter-PDF-Generator-Library
And it works wonders except, It doesn't keep the style sheet when the pdf is generated.
I am trying to use bootstrap to make it look nice, But when I run the script and download the pdf it doesn't have the styling anymore. What do I need to do to keep the stylesheet linked?
My Controller:
public function AdminPracticeSheetLateReport()
{
$this->load->view('pdf/practiceLateReport');
$this->pdf->load_view('pdf/practiceLateReport');
$this->pdf->render();
$this->pdf->stream("welcome.pdf");
}
I am loading the bootstrap stylesheet like so in my view:
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
Is this even possible with this plugin? If not it's quite the crappy plugin if you ask me.
BTW: This library for codeigniter uses the DomPDF
I just checked the source code of codeigniter and noticed that it does not itself make a PDF, but uses DOMPDF in turn (which is another PHP library). codeigniter does not properly send the html and css to DOMPDF, so in my suggestion you should remove codeigniter and use DOMPDF instead. This should correct your problem and also speed up the conversion by a few miliseconds.