mpdf无视javascript [英] mpdf ignoring javascript
问题描述
我在这里有一个问题..
i have a question here..
我使用缓冲来获取使用mpdf的pdf文件..
i'd use buffering to get the pdf files using mpdf..
但我在这里有点困惑..
but i gett a little confused here..
我在页面上有一些我被缓冲的javascript ..但是来自javascript的生成内容不会转换为pdf ..
i have some javascript on the page that i was buffered.. but the generate content from javascript wont converted into pdf..
让我直截了当..
让我说我有这个元素
<div id='text'></div>
在我的页面上我有一个javascript代码来向该div添加文本..
结果是......
and on my page i have a javascript code to add text to that div.. and the results is...
[通过浏览器打开页面]
[open page via browser]
<div id='text'>TEXT I ADDED USING JAVASCRIPT</div>
但当我将其转换为pdf ...
but when i convert it to pdf...
<div id='text'></div> (I DIDNT GET THAT TEXT)
这是使用的脚本..
template.php
This is script is used.. template.php
ob_start();
// content of page (included inline javascript code)
$yourfile = ob_get_content();
$_SESSION[forms] = $yourfile;
echo $yourfile;
convert.php
convert.php
session_start();
include("MPDF54/mpdf.php");
$mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
$mpdf->WriteHTML($_SESSION[forms]);
$mpdf->Output();
任何团体都可以帮我这个???
Any body can help me with this???
推荐答案
mpdf
支持基本的javascript。
mpdf
supports basic javascript.
PDF阅读器理解基本的javascript功能。
PDF readers understands basic javascript functions.
喜欢 print();
你可以使用 SetJS()$添加它c $ c> mpdf库的功能。
like print();
you can add it using SetJS()
function of mpdf library.
include("MPDF54/mpdf.php");
$mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
$mpdf->WriteHTML($_SESSION[forms]);
$mpdf->SetJS('print();') //JS code with <script></script> tags.
$mpdf->Output();
这篇关于mpdf无视javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!