Я пытаюсь загрузить всю страницу в формате PDF, используя JSPDF, однако текст в сгенерированном файле PDF уходит со страницы - PullRequest
0 голосов
/ 05 ноября 2018

Вот мой код, я пытаюсь скачать div с именем PDFContent, который содержит количество изображений и текстов. Изображения помещаются в PDF-файл, а текст - нет.

$ ("# downloadManual"). Click (function () { console.log («Работа над созданием PDF»)

        var pdf = new jsPDF('p', 'pt', 'letter');
        //var pdf = new jsPDF();

        source = $('#PDFContent').html();

        specialElementHandlers = {
            // element with id of "bypass" - jQuery style selector
            '#bypassme' : function(element, renderer) {
                // true = "handled elsewhere, bypass text extraction"
                return true
            }
        };

        margins = {
            top : 5,
            bottom : 60,
            left : 10,
            width : 700
        };

        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
            headerFooterFormatting(pdf, pdf.internal.getNumberOfPages());
            pdf.save('Test.pdf');
        }, margins);

    });//end of button click event
...