Раньше мой pdf-файл экспорта функционировал, однако теперь он не работает, и я получаю эту необработанную ошибку всякий раз, когда нажимаю кнопку. Я использую исходный код javascript из https://micropyramid.com/blog/export-html-web-page-to-pdf-using-jspdf/ Я новичок ie, мне нужна помощь.
Uncaught TypeError: Cannot read property '1' of undefined
at Renderer.renderParagraph (jspdf.debug.js:8005)
at Renderer.setBlockBoundary (jspdf.debug.js:8055)
at DrillForContent (jspdf.debug.js:7607)
at DrillForContent (jspdf.debug.js:7575)
at jspdf.debug.js:7743
at done (jspdf.debug.js:7618)
at Image.img.onerror.img.onload (jspdf.debug.js:7640)
Мой Javascript код
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.debug.js"></script>
<script type="text/javascript">
//reference: https://micropyramid.com/blog/export-html-web-page-to-pdf-using-jspdf/
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'A4');
// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
source = $('#content')[0];
specialElementHandlers = {
// element with id of "bypass" - jQuery style selector
'#bypassme': function(element, renderer) {
// true = "handled elsewhere, bypass text extraction"
return true
}
};
margins = {
top: 20,
bottom: 0,
left: 50,
width: 522
};
// all coords and widths are in jsPDF instance's declared units
// 'inches' in this case
pdf.fromHTML(
source, // HTML string or DOM elem ref.
margins.left, // x coord
margins.top, { // y coord
'width': margins.width, // max width of content on PDF
'elementHandlers': specialElementHandlers
},
function(dispose) {
// dispose: object with X, Y of the last line add to the PDF
// this allow the insertion of new lines after html
var filename = 'NTS and PESTA 2020 Refund Verification Letter' + '_' + $('#name').val()
pdf.save(filename + '.pdf');
}, margins
);
}
</script>