HTML to PDF using js with utf-8 support

2019-08-08 03:05发布

I need to export a web page as pdf it's html content that I display in the browser, I want to give the user the capability to download it as pdf, I tried jsPDF but it doesn't support arabic I need pdf not word, and I need to do it in the client side. please help Thanks in advance,

1条回答
该账号已被封号
2楼-- · 2019-08-08 03:31

Demo: http://jsfiddle.net/kumarrishikesh12/rwdL0rxh/

<script async src="//jsfiddle.net/kumarrishikesh12/rwdL0rxh/embed/"></script>

OR

function doit(){
if (!window.print){
alert("You need NS4.x to use this print button!")
return
}
window.print()
}
color:#C03;
	font-size:18px; font-family:"Courier New", Courier, monospace;
	}
p{ font-family:"Comic Sans MS", cursive;
font-size:15px; color:#066; text-align:justify;}
a{
	text-decoration:none;
	font-size:20px; }
<body>

<div style="float:right;">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- sidebar300X600 -->
<ins class="adsbygoogle"
     style="display:inline-block;width:300px;height:600px"
     data-ad-client="ca-pub-1456458421931279"
     data-ad-slot="1562820743"></ins>

</div>

<div style="width:500px; height:600px; border:2px #093 dashed; margin:0 auto; padding:10px;">
<h2>What is PHP?</h2>

<p>PHP is a server side scripting language commonly used for web applications</p>

<h2>How to include a file to a php page?</h2>

<p>we can include a file using &quot;include() &quot; or &quot;require()&quot; function with as its parameter..</p>

<h2>What&#39;s the difference between include and require?</h2>

<p>If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.</p>

<h2>What Is a Session?</h2>

<p>It can be used to store information on the server for future use</p>

<h2>How to set cookies in PHP?</h2>

<p>Cookies are often used to track user information Syntax: Setcookie(name, value, expire, path, domain); eg:Setcookie(&quot;sample&quot;, &quot;ram&quot;, time()+3600);</p>

<div align="center"><a href="javascript:doit()"><img align="middle" border="0" src="http://demos.2my4edge.com/2my4edge-print-page/icon-48-print.png" /> Click here to Print the Page</a></div>
</div>


</body>

查看更多
登录 后发表回答