How to use external css in tcpdf pdf generation

心不动则不痛 提交于 2019-12-04 16:42:05

问题


I am trying to create a pdf of a web page with tcpdf. But it's not working. The page is a php with external css and javascript files.

Can anyone help me with this.

Thanks,


回答1:


To include external CSS file, you can do as below before you add your HTML content

$html .= '<style>'.file_get_contents(_BASE_PATH.'stylesheet.css').'</style>';

By this, while you pass $html to generate pdf it will include those styles.

As far I am aware, there is no need for including Javascript into a PDF. The purpose of a PDF is to display a non-interactive static content, which can be achieved by HTML and CSS



来源:https://stackoverflow.com/questions/19002634/how-to-use-external-css-in-tcpdf-pdf-generation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!