如何在tcpdf pdf生成中使用外部CSS [英] How to use external css in tcpdf pdf generation
本文介绍了如何在tcpdf pdf生成中使用外部CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用tcpdf创建网页的pdf。但这不起作用。该页面是一个带有外部CSS和javascript文件的php。
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.
有人可以帮我吗?
谢谢,
推荐答案
要包含外部CSS文件,可以在添加 HTML之前执行以下操作
内容
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>';
与此同时,您通过 $ html
据我所知,无需包含 Javascript
放入 PDF
。 PDF的目的是显示非交互式静态内容,这可以通过 HTML
和 CSS
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
这篇关于如何在tcpdf pdf生成中使用外部CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文