html表格的图片没有以pdf格式显示

时间:2015-03-20 11:10:48

标签: javascript jspdf

我有html表,其中包含我将html表导出为pdf的图像。表已导出但图像未显示我如何显示它。使用jspdf。

代码如下,我正在使用jspdf.debug.js文件     function pdfConvert(){

    var pdf = new jsPDF('p', 'pt', 'a4');
    pdf.setFontSize(15);
    console.log(pdf);
    pdf.text(170, 13, 'Status Report');
    pdf.setFontSize(10);
   var source = $('#tblToPrint')[0]
        , specialElementHandlers = {
            // element with id of "bypass" - jQuery style selector
            '#Data': function(element, renderer){
                // true = "handled elsewhere, bypass text extraction"
                return true
            }
        }

    margins = {
        top: 40,
        bottom: 40,
        left: 20,
        width: '100%'
    };
    pdf.fromHTML(
        source // HTML string or DOM elem ref.
        , 30//margins.left // x coord
        , 10//margins.top // y coord
        , {
            'width': margins.width,
        'elementHandlers': specialElementHandlers
        },
        function (dispose) {
            pdf.save('Test.pdf');
        },
        margins
    )
}

而我的html表格包含图片

 <tbody id="TBM">
  <tr>
    <td  bgcolor="#D9D9D9"><strong>ms</strong></td>
    <td  bgcolor="#D9D9D9"><strong>we</strong></td>
    <td  bgcolor="#D9D9D9"><strong>Pa</strong></td>
    <td align="center" bgcolor="#D9D9D9"><strong>AL</strong></td>
    <td  bgcolor="#D9D9D9"><strong>Short comment</strong></td>
    <td colspan="4" align="center" bgcolor="#D9D9D9"><strong>sta</strong></td>
  </tr>
     <tr>
    <td>dfsdf</td>
    <td> sdfdd</td>
    <td >sdfdsf</td>
    <td >dfsd</td>
    <td >shtCmt</td>
    <td width="30px" class="tdClick">
    <img  src="img/TickStatus.jpg">
    </td>
    <td width="30px" class="tdClick">
    <img  src="img/RedStatus.jpg">
    </td>
    <td width="30px" class="tdClick">
    <img  src="img/BlueStatus.jpg">
    </td>
    <td width="30px" class="tdClick">
    <img  src="img/OrangeStatus.jpg">
    </td>

    </tr>
 </tbody>

0 个答案:

没有答案
相关问题