使用jspdf的连字符空间BUG

时间:2017-01-17 16:08:04

标签: jspdf hyphen

有人知道如何解决这个空间错误吗?

只复制下面的代码,粘贴并另存为.html并下载jspdf使用过的插件。

仅在使用连字符时才会出现此问题。任何其他角色都没有问题。

谢谢!!!

 <HTML>
 <HEAD>
 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

    <script src='require.js'></script>
    <script src="jspdf.js"></script>
    <script src="context2d.js"></script>
    <script src="html2canvas.js"></script>
    <script src="canvas.js"></script>
    <script src="standard_fonts_metrics.js"></script>
    <script src="html2pdf.js"></script>

    <script>

    function goPDF()
    {
       require ( ['./js/jspdf/html2pdf'], function()
       {
          var obj = document.getElementById("div_pdf");

          var html = obj.innerHTML;

          var params =
          {
             orientation : 'p',
             unit        : 'pt',
             format      : 'a4'
          };

          var pdf = new jsPDF(params, '', '');

          html2pdf ( html, pdf, function()
          {
             pdf.output('dataurlnewwindow');
          }); // html2pdf

       }); // require './js/jspdf/html2pdf'

    } // goPDF()

    </script>

 </HEAD>

 <BODY>

 <a href="javascript:goPDF()">Generate PDF</a>

 <div><span style="font-family:courier;font-size:8pt">04.234-72</span></div>

 <div id="div_pdf" style="visibility:hidden">

 <div><span style="font-family:courier;font-size:8pt">04.234-72</span></div>

 </div>  <!-- div id="div_pdf" -->

 </BODY>

 </HTML>

0 个答案:

没有答案