Kendo PDF export a HTML element to a fixed size in PDF irrespective of screen size

69 views Asked by At

I am trying to export a HTML element(chart) to PDF using Kendo PDF export which works fine when I use the correct scale on a maximised browser. But when I try to export the page with resized screen or a mobile sized screen the element resizes on screen and when this is exported to PDF, the exported item get much smaller and unreadable in PDF.

As I have fixed the export PDF papersize to A4, Is there a way to provide a fixed export height and width for the element to export to?

   function OnPDFExport() {

        var progress = $.Deferred();
        var exportSettings = {
            avoidLinks: true,
            forcePageBreak: ".page-break",
            paperSize: "A4",
            scale: 0.5,  -- this is relative, if the browser screen is resized or mobile sized, the exported element size in PDF changes 
            margin: { left: "1cm", top: "4cm", right: "1cm", bottom: "0.5cm" },
            template: $("#page-template").html()
        };

        kendo.drawing.drawDOM($(".selected-item"), exportSettings).then(function (group) {
            return kendo.drawing.exportPDF(group)
        }).done(function (dataURI) {
            kendo.saveAs({
                dataURI: dataURI,
                fileName: "Report.pdf"
            });
            progress.resolve();
        })
    }
0

There are 0 answers