在使用 jspdf 下载加载 aspx 页面到 pdf 时,我得到的 pdf 大小根据我打开此 aspx 的设备大小而变化

While downloading on load aspx page to pdf using jspdf ,I am getting pdf which size is varying according to the size of device I am opening this aspx

你能帮我解决这个问题吗? 函数 doPrint(){

  var doc = new jsPDF();
            var specialElementHandlers = {
                '#editor': function(element, renderer) {
                    return true;
                }
            };
            doc.fromHTML($('#IDBodyHike'), 15, 15, {
                'width': 170,
                'elementHandlers': specialElementHandlers
            });
            doc.addHTML($('#IDBodyHike'), function() {
                doc.save('sample-file.pdf');
            });

} }

正文加载="doPrint();" >

http://beta.iamgds.com/HikeTicketDownload.aspx?PNR=107400664-1251138&TicketNo=5017183648 中的 PDF 本质上是 HTML 浏览器视图的 屏幕截图 (即只是一张图片,它没有 text 以普通 PDF 的方式)。

因此,不同的设备对内容的看法略有不同(由于不同的分辨率等)。因此 pdf 文件具有不同的大小。